Exemplo n.º 1
0
 public void PlayJumpAnim(Vector3 moveDir)
 {
     if (moveDir.x >= 0)
     {
         unitAnimation.PlayAnim(UnitAnim.GetUnitAnim("dBareHands_JumpRight"));
     }
     else
     {
         unitAnimation.PlayAnim(UnitAnim.GetUnitAnim("dBareHands_JumpLeft"));
     }
 }
Exemplo n.º 2
0
 public void SetMoveVector(Vector3 moveVector)
 {
     if (moveVector == Vector3.zero)
     {
         // Idle
         unitAnimation.PlayAnim(idleAnimType, lastMoveVector, idleFrameRate, null, null, null);
     }
     else
     {
         // Moving
         lastMoveVector = moveVector;
         unitAnimation.PlayAnim(walkAnimType, lastMoveVector, walkFrameRate, null, null, null);
     }
 }
Exemplo n.º 3
0
 public AnimatedWalker(V_UnitAnimation unitAnimation, UnitAnimType idleAnimType, UnitAnimType walkAnimType, float idleFrameRate, float walkFrameRate)
 {
     this.unitAnimation = unitAnimation;
     this.idleAnimType  = idleAnimType;
     this.walkAnimType  = walkAnimType;
     this.idleFrameRate = idleFrameRate;
     this.walkFrameRate = walkFrameRate;
     lastMoveVector     = new Vector3(0, -1);
     unitAnimation.PlayAnim(idleAnimType, lastMoveVector, idleFrameRate, null, null, null);
 }
Exemplo n.º 4
0
        private void Start()
        {
            Transform bodyTransform = transform.Find("Body");

            unitSkeleton  = new V_UnitSkeleton(1f, bodyTransform.TransformPoint, (Mesh mesh) => bodyTransform.GetComponent <MeshFilter>().mesh = mesh);
            unitAnimation = new V_UnitAnimation(unitSkeleton);
            unitAnimation.PlayAnim(GameAssets.UnitAnimTypeEnum.dMinion_Idle, 1f, null, null, null);

            state = State.Normal;
        }
Exemplo n.º 5
0
    private void Start()
    {
        Transform bodyTransform = transform.Find("Body");

        unitSkeleton  = new V_UnitSkeleton(1f, bodyTransform.TransformPoint, (Mesh mesh) => bodyTransform.GetComponent <MeshFilter>().mesh = mesh);
        unitAnimation = new V_UnitAnimation(unitSkeleton);

        idleUnitAnimType = UnitAnimType.GetUnitAnimType("dBareHands_Idle");

        unitAnimation.PlayAnim(idleUnitAnimType, new Vector3(0, -1), 1f, null, null, null);
    }
Exemplo n.º 6
0
        private void Update()
        {
            switch (state)
            {
            case State.Normal:
                if (playerHandler.IsDead())
                {
                    unitAnimation.PlayAnim(GameAssets.UnitAnimTypeEnum.dMinion_Idle, lastMoveDir, 1f, null, null, null);
                }
                else
                {
                    HandleMovement();
                    HandleAttack();
                }
                break;

            case State.Busy:
                break;
            }
            unitSkeleton.Update(Time.deltaTime);
        }
Exemplo n.º 7
0
        private void HandleMovement()
        {
            float moveX = 0;
            float moveY = 0;

            if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.UpArrow))
            {
                moveY = 1;
            }
            if (Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.DownArrow))
            {
                moveY = -1;
            }
            if (Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.LeftArrow))
            {
                moveX = -1;
            }
            if (Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.RightArrow))
            {
                moveX = 1;
            }

            Vector3 moveDir = new Vector3(moveX, moveY).normalized;

            lastMoveDir = moveDir;
            bool isIdle = moveX == 0 && moveY == 0;

            if (isIdle)
            {
                lastMoveDir = Vector3.down;
                unitAnimation.PlayAnim(GameAssets.UnitAnimTypeEnum.dSwordTwoHandedBack_Idle, lastMoveDir, 1f, null, null, null);
            }
            else
            {
                unitAnimation.PlayAnim(GameAssets.UnitAnimTypeEnum.dSwordTwoHandedBack_Walk, lastMoveDir, .75f, null, null, null);
                Dirt_Handler.SpawnInterval(GetPosition() + new Vector3(0, -4), lastMoveDir * -1);
            }
            transform.position = transform.position + moveDir * speed * Time.deltaTime;
        }
 public void PlayWalkingAnimation(Vector3 animationDir)
 {
     unitAnimation.PlayAnim(walkUnitAnim, animationDir, .6f, null, null, null);
 }