コード例 #1
0
ファイル: mainGuyController.cs プロジェクト: FenGsHt/Tenet
    private Vector2 UpdateInfo()
    {
        if (body.tenetDirection == 0)   //只有逆向主角才会冲刺
        {
            SpeedUpWhileAttack(attack);
        }

        Vector2 position = new Vector2();


        //当没死时可以用
        if (anim.GetBool("dead") == false)
        {
            position += body.Jumping(jump, 0, new Vector2());  //调用Jump函数

            position += body.Walk(horizontal, Vector2.zero);   //调用humanBody的Walk;

            body.Attack(horizontal, attack, Vector2.zero);
        }

        //Debug.Log("qwe");


        return(position);
    }
コード例 #2
0
    //awdqwfqwwad
    private Vector2 Replay(Egg egg, int direction)
    {
        Vector2 position = transform.position;

        //direction决定是否和egg原有的direction一致,如果direction都为1则一致,为-1则相反

        //根据参数来进行各自的动作
        switch (egg.movement)
        {
        case ActionEnum.movement.walk:
            position = body.Walk(direction * -egg.parm1, egg.position);
            break;

        case ActionEnum.movement.attack:
            position = body.Attack(body.direction, true, egg.position);
            //Debug.Log("Attack");
            break;

        case ActionEnum.movement.jump:
            position = body.Jumping(1, (int)egg.parm2, egg.position);      //实现跳一百帧就是插入一百次即可
            //Debug.Log(egg.parm1 + "   " + egg.parm2);
            break;

        case ActionEnum.movement.dead:
            //Debug.Log("复活");
            body.Dead(1);
            position = egg.position;      //可能也要赋予位置
            break;

        case ActionEnum.movement.gravity:
            position = body.Gravity(egg.position);
            //Debug.Log("gravity");
            break;

        case ActionEnum.movement.bulletMove:
            position = egg.position;
            //Debug.Log("gravity");
            break;

        case ActionEnum.movement.bulletBack:

            transform.GetComponent <bullet>().speed = direction * -egg.parm1;

            //gameObject.SetActive(true);
            //Debug.Log(egg.parm1);
            GetComponent <BoxCollider2D>().enabled = true;

            //修改子弹的z坐标为-3
            transform.position = new Vector3(egg.position.x, egg.position.y, 3);

            position = transform.position;
            //Debug.Log(transform.position);
            //Debug.Log("gravity");
            break;

        case ActionEnum.movement.bulletGone:
            position = egg.position;
            //当frame还可以计入事件帧时才会销毁
            if (direction == Master.currentDirection)
            {
                Debug.Log("bullet销毁");
                Destroy(gameObject, 0);        //去除子弹
            }

            break;

        case ActionEnum.movement.targetConfirm:
            position = egg.position;
            body.GetAnimator().SetFloat("Speed", 1f);
            //body.SetFloat("Speed", 1f);
            body.transform.Find("CursorCollider").GetComponent <SpriteRenderer>().color = Color.white;

            body.tenetDirection = 1;         //将其状态改回原来的
            break;

        case ActionEnum.movement.findMainguy:
            position = egg.position;

            if (body.tenetDirection == Master.currentDirection)
            {
                body.target = null;
            }

            break;

        default:
            break;
        }

        return(position);

        //123
    }
コード例 #3
0
ファイル: AITool.cs プロジェクト: FenGsHt/Tenet
 public static void Attack(humanBody body)
 {
     body.Attack(body.direction, true, Vector2.zero);
 }