Exemplo n.º 1
0
        public LFloat GetMaxMoveDist(EDir dir, LVector2 fHeadPos, LVector2 fTargetHeadPos, LFloat borderSize)
        {
            var iTargetHeadPos =
                new LVector2Int(LMath.FloorToInt(fTargetHeadPos.x), LMath.FloorToInt(fTargetHeadPos.y));
            var hasCollider = HasColliderWithBorder(dir, fTargetHeadPos, borderSize);
            var maxMoveDist = LFloat.MaxValue;

            if (hasCollider)
            {
                switch (dir)
                {
                case EDir.Up:
                    maxMoveDist = iTargetHeadPos.y - fHeadPos.y;
                    break;

                case EDir.Right:
                    maxMoveDist = iTargetHeadPos.x - fHeadPos.x;
                    break;

                case EDir.Down:
                    maxMoveDist = fHeadPos.y - iTargetHeadPos.y - 1;
                    break;

                case EDir.Left:
                    maxMoveDist = fHeadPos.x - iTargetHeadPos.x - 1;
                    break;
                }
            }

            return(maxMoveDist);
        }
Exemplo n.º 2
0
        public virtual void DoUpdate(LFloat deltaTime, EntityAttri ownerAttri)
        {
            if (timer > counter * config.triggerInterval)
            {
                counter++;
                //trigger buff
                for (int i = 0; i < config.count; i++)
                {
                    var at   = config.Attris[i];
                    var type = (EEntityAttriType)System.Math.Abs(at.attriType);
                    switch (type)
                    {
                    case EEntityAttriType.Hp: {
                        ownerAttri.Hp += at.val + LMath.FloorToInt(at.percent * triggerAttri.Hp);
                        break;
                    }

                    case EEntityAttriType.MaxHp: {
                        ownerAttri.MaxHp += at.val + LMath.FloorToInt(at.percent * triggerAttri.Hp);
                        break;
                    }
                    }
                }
            }
        }
 public static int3 floor(LVector3 vec)
 {
     return(new int3(
                LMath.FloorToInt(vec.x),
                LMath.FloorToInt(vec.y),
                LMath.FloorToInt(vec.z)
                ));
 }
Exemplo n.º 4
0
 public static Vector2Int Floor(this LVector2 vec)
 {
     return(new Vector2Int(LMath.FloorToInt(vec.x), LMath.FloorToInt(vec.y)));
 }