Ejemplo n.º 1
0
        void Awake()
        {
            attributes = new Attributes();
            _UUID      = System.Guid.NewGuid();

            // TODO: Sane defaults?
            creatureType = MobileTypes.Acrobat;
            behaviour    = MobileBehaviour.General;

            DaggerfallUnity.FindDaggerfallUnity(out dfUnity);
            //setupMobile();
        }
Ejemplo n.º 2
0
        override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
        {
            base.OnStateUpdate(animator, stateInfo, layerIndex);
            if (MobileBehaviour.WeaponBehaviour != null && MobileBehaviour.WeaponBehaviour.IsRanged && PlayerBehaviour != null)
            {
                var isAlignedOnYAxis = Math.Abs(MobileBehaviour.transform.position.x - PlayerBehaviour.transform.position.x) < aimRange;
                var isAlignedOnXAxis = Math.Abs(MobileBehaviour.transform.position.y - PlayerBehaviour.transform.position.y) < aimRange;
                if (isAlignedOnYAxis || isAlignedOnXAxis)
                {
                    if (isAlignedOnXAxis)
                    {
                        if (MobileBehaviour.transform.position.x < PlayerBehaviour.transform.position.x)
                        {
                            MobileBehaviour.SetLastDirection(Vector2.right);
                        }
                        else
                        {
                            MobileBehaviour.SetLastDirection(Vector2.left);
                        }
                    }
                    else
                    {
                        if (MobileBehaviour.transform.position.y < PlayerBehaviour.transform.position.y)
                        {
                            MobileBehaviour.SetLastDirection(Vector2.up);
                        }
                        else
                        {
                            MobileBehaviour.SetLastDirection(Vector2.down);
                        }
                    }

                    MobileBehaviour.Attack();
                }
                else
                {
                    CurrentMovement = GetRangedMovement();
                }
            }
            else
            {
                MobileBehaviour.Attack();
            }
        }