Пример #1
0
        void Start()
        {
            if (null == model)
            {
                Debug.LogError("No model specified for " + transform.name);
                return;
            }

            if (tiles_required.x < 1)
            {
                tiles_required.x = 1f;
            }
            if (tiles_required.y < 1)
            {
                tiles_required.y = 1f;
            }
            character_id = ++__character_id;
            attack_state = tbbeAttackState.Config;

            _model               = (Transform)Instantiate(model);
            _model.parent        = transform;
            _model.localPosition = Vector3.zero;
            _model.localRotation = Quaternion.identity;

            controller = GetComponentInChildren <Animator>();
            anim       = GetComponentInChildren <Animation>();

            onDamageTaken += PlayDamageAnimation;
            onDied        += DoDying;

            if (null == controller)
            {
                if (null == anim)
                {
                    Debug.LogError("Animation component not found for " + transform.name);
                }
                else
                {
                    anim.Play(idle_animation_names[0]);
                }
            }
            else
            {
                controller.Play(idle_animation_names[0]);
            }
        }
Пример #2
0
 void DoDying(Ch character)
 {
     attack_state = tbbeAttackState.Dead;
     PlayDieAnimation();
 }