Пример #1
0
    public override ACTION_RESULT ActionUpdate()
    {
        stun_counter += Time.deltaTime;
        if (interupt == true)
        {
            anim_comp.SetTransition("ToIdleAttack");
            return(ACTION_RESULT.AR_FAIL);
        }

        if (stun_counter > stun_duration)
        {
            stun_counter = 0;
            anim_comp.SetTransition("ToIdleAttack");
            return(ACTION_RESULT.AR_SUCCESS);
        }


        /*if (anim_comp.IsAnimationStopped("Stun"))
         * {
         *  anim_comp.SetTransition("ToIdleAttack");
         *  return ACTION_RESULT.AR_SUCCESS;
         * }*/

        // Does nothing
        return(ACTION_RESULT.AR_IN_PROGRESS);
    }
Пример #2
0
 public override bool ActionStart()
 {
     state = SWA_STATE.PRE_APPLY;
     anim  = GetComponent <CompAnimation>();
     anim.SetTransition("ToAttack");
     anim.SetClipDuration("Attack", attack_duration);
     player = GetLinkedObject("target").GetComponent <CharactersManager>();
     //Interrupt player action
     return(true);
 }
    public override bool ActionStart()
    {
        anim_comp = GetComponent <CompAnimation>();

        anim_comp.SetTransition("ToSheatheSword");
        //TODO_AI: Audio disengage?
        //GetComponent<CompAudio>().PlayEvent("Dracarys");
        anim_comp.SetClipDuration("Sheathe Sword", duration);


        //PLAY COMBAT MUSIC
        Audio.ChangeState("MusicState", "None");
        GetLinkedObject("event_manager").GetComponent <PerceptionManager>().player_seen = false;
        Debug.Log("COMBAT OFF", Department.PLAYER, Color.BLUE);

        return(true);
    }
Пример #4
0
    public override ACTION_RESULT ActionUpdate()
    {
        if (interupt == true)
        {
            return(ACTION_RESULT.AR_FAIL);
        }

        Vector3 my_pos = transform.position;

        Vector3 movement = new Vector3(Vector3.Zero);

        if (anim_comp.IsAnimationStopped(animation_clip_push))
        {
            anim_comp.SetTransition("ToIdleAttack");
            Debug.Log("Tile Destiny x: " + target_x + "y:" + target_y, Department.IA, Color.YELLOW);
            move.SetEnemyTile(target_x, target_y);

            movement.x = (target_x * move.tile_size) - my_pos.x;
            movement.z = (target_y * move.tile_size) - my_pos.z;

            movement = (movement.Normalized * move.tile_size * (1 - arrive_comp.min_distance)) * push_velocity;
            transform.SetPosition(my_pos + ((movement * Time.deltaTime) / push_time));

            if (push_timer >= 0.01f)
            {
                push_timer = 0.0f;
                return(ACTION_RESULT.AR_SUCCESS);
            }
            else
            {
                push_timer = push_timer + Time.deltaTime;
                return(ACTION_RESULT.AR_IN_PROGRESS);
            }
        }

        movement.x = (target_x * move.tile_size) - my_pos.x;
        movement.z = (target_y * move.tile_size) - my_pos.z;

        movement = (movement.Normalized * move.tile_size * (1 - arrive_comp.min_distance)) * push_velocity;
        transform.SetPosition(my_pos + ((movement * Time.deltaTime) / push_time));

        return(ACTION_RESULT.AR_IN_PROGRESS);
    }