Exemplo n.º 1
0
    public override void Think(Thinker thinker)
    {
        DrakeController    drake     = thinker.Remember <DrakeController>("drake");
        MovementController mc        = thinker.Remember <MovementController>("movement");
        AttackController   at        = thinker.Remember <AttackController>("attack");
        Vector2            moveInput = thinker.Remember <Vector2>("moveInput");

        if (!mc.IsGrounded)
        {
            return;
        }

        if (moveInput.sqrMagnitude <= 0)
        {
            moveInput = new Vector2(1, 0);
        }
        else if (mc.IsAtWall() || mc.IsAtEdge())
        {
            moveInput.x *= -1;
        }

        thinker.Remember("moveInput", moveInput);
        drake.Walk(moveInput);

        if (target.Value != null && at.AttackCollider.bounds.Intersects(target.Value.bounds))
        {
            drake.Attack();
        }
    }
Exemplo n.º 2
0
 public override void Think(Thinker thinker)
 {
     if (!thinker.HasMemory("coroutineStarted"))
     {
         thinker.Remember("coroutineStarted", true);
         float           punchInterval = thinker.Remember <float>("punchInterval");
         DrakeController drake         = thinker.Remember <DrakeController>("drake");
         thinker.StartCoroutine(
             CoroutineUtils.Repeat(() => { drake.Attack(); }, 0, punchInterval));
     }
 }
Exemplo n.º 3
0
    public override void Think(Thinker thinker)
    {
        DrakeController drake     = thinker.GetComponent <DrakeController>();
        Vector2         moveInput = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));

        drake.Walk(moveInput);
        if (Input.GetButtonDown("Jump") || moveInput.y > 0)
        {
            drake.Jump();
        }

        if (Input.GetKeyDown(KeyCode.J))
        {
            drake.Attack();
        }
    }