Esempio n. 1
0
    // Start is called before the first frame update
    void Start()
    {
        Host = gameObject.GetComponent <ActionUnit>();
        CharacterAnimationEventCalls eventUnit = gameObject.GetComponentInChildren <CharacterAnimationEventCalls>();

        eventUnit.RegisterListener(CharacterAnimationEventCalls.K_STATE_ATTACK_IN).AddListener(UnlockTarget);
    }
Esempio n. 2
0
    public void SpawnCharacter()
    {
        if (tileUnitData && characterPrefabParent)
        {
            GameObject spawned = Instantiate(tileUnitData.characterPrefab, characterPrefabParent, false);
            characterPrefabParent.transform.ChangeLayersRecursively(gameObject.layer);

            _animator = GetComponentInChildren <Animator>();
            UpdateAnimClipTimes();
            CalculateStatusStat();
            _characterAnimationEventCalls = GetComponentInChildren <CharacterAnimationEventCalls>();
            _characterAnimationEventCalls.RegisterListener(CharacterAnimationEventCalls.K_ACTION_ATTACK).AddListener(AttackApplyDamage);
            _characterAnimationEventCalls.RegisterListener(CharacterAnimationEventCalls.K_ACTION_ATTACK_END).AddListener(RecoverSpeedAnimate);
            Events.InvokeOnAction(EVENT_UNIT_LIVE);
        }
    }