public override void OnInit()
        {
            animatorFeature = Entity.GetFeature <AnimatorFeature>();
            healthAttribute = Entity.GetAttribute <HealthAttribute>();
            player          = Entity.GetFeature <ObjectFeature>().GetComponent <PlayerAttack>();

            RegisterMessage(MessageID.HealthUpdate, (IBody body) => {
                if (debug)
                {
                    Debug.Log("message healthupdate");
                }
                float damage = (body as FloatBody).value;
                healthAttribute.curHealth -= damage;
                //player.health = healthAttribute.curHealth;
                //player.health -= damage;
                if (debug)
                {
                    Debug.Log(Entity.Id + " health is " + healthAttribute.curHealth);
                }
                //player.HealthChange(healthAttribute.curHealth);
                GetStab();
            });

            RegisterMessage(MessageID.PlayerHurt, (IBody body) => {
                uint targetId = (body as UintBody).value;
                if (debug)
                {
                    Debug.Log("message player hurt " + targetId);
                }
                player.GetStab(targetId);
            });
        }
Exemple #2
0
        public override void OnInit()
        {
            animatorFeature = Entity.GetFeature <AnimatorFeature>();
            playerAttack    = Entity.GetFeature <ObjectFeature>().gameObject.GetComponent <PlayerAttack>();

            isSpecialMove = false;

            RegisterFixedUpdate(OnFixedUpdate);
        }