NScumm.Sword1.Logic.fnIsFacing C# (CSharp) Метод

fnIsFacing() приватный Метод

private fnIsFacing ( SwordObject cpt, int id, int targetId, int b, int c, int d, int a, int z ) : int
cpt SwordObject
id int
targetId int
b int
c int
d int
a int
z int
Результат int
        private int fnIsFacing(SwordObject cpt, int id, int targetId, int b, int c, int d, int a, int z)
        {
            SwordObject target = _objMan.FetchObject((uint)targetId);
            int x, y, dir;
            if ((target.type == Screen.TYPE_MEGA) || (target.type == Screen.TYPE_PLAYER))
            {
                x = target.xcoord;
                y = target.ycoord;
                dir = target.dir;
            }
            else
                throw new InvalidOperationException("fnIsFacing:: Target isn't a mega");

            int lookDir = WhatTarget(x, y, cpt.xcoord, cpt.ycoord);
            lookDir -= dir;
            lookDir = Math.Abs(lookDir);

            if (lookDir > 4)
                lookDir = 8 - lookDir;

            ScriptVars[(int)ScriptVariableNames.RETURN_VALUE] = (uint)lookDir;
            return SCRIPT_STOP;
        }