public override void OnReceiveMessage(tdMessageType msgType, object[] args)
    {
        switch (msgType)
        {
        case tdMessageType.Move:
            float horizontal = (float)args[0];
            MoveEntity(horizontal);
            Entity.RotateEntity(horizontal);
            if (Entity.OnGround)
            {
                MovementAnimation(horizontal);
            }
            break;

        case tdMessageType.Jump:
            Entity.AnimCtrl.SetTrigger("jump");
            Entity.AnimCtrl.SetFloat("nav_speed", 0);
            Entity.Velocity = new Vector2(Entity.Velocity.x, 0);
            Entity.RgdBdy.AddForce(Vector2.up * Entity.JumpSpeed, ForceMode.Impulse);
            Entity.JumpTimer = 0;
            break;

        case tdMessageType.Attack:
            //go to attack state
            Entity.ChangeState(typeof(tdAttackState), args);
            break;

        case tdMessageType.Flinch:
            //chance to change state or idk to be discussed
            break;

        default:
            break;
        }
    }
    public override void OnReceiveMessage(tdMessageType msgType, object[] args)
    {
        switch (msgType)
        {
        //TODO continuous combo
        case tdMessageType.Attack:
            tdAttack currentAtk = (tdAttack)args[0];
            Entity.AnimCtrl.SetInteger("anim_state", (int)currentAtk.AnimState);
            break;

        case tdMessageType.Flinch:
            break;
        }
    }
예제 #3
0
 public void OnAnimationEvent(tdMessageType callbackevent)
 {
     //Callback(callbackevent);
     _entity.SendMessageToBrain(callbackevent);
 }
예제 #4
0
 public abstract void OnReceiveMessage(tdMessageType msgType, object[] args);
예제 #5
0
 /// <summary>
 /// Will be used on the entity controller to separate inputs and behaviour.
 /// Can also be used as a reaction for AI
 /// </summary>
 /// <param name="msgtype">message type</param>
 /// <param name="args">anything to pass through</param>
 public void SendMessageToBrain(tdMessageType msgType, params object[] args)
 {
     _existing.OnReceiveMessage(msgType, args);
 }