Exemplo n.º 1
0
    void UpdateDamage(int dmg, bool player)
    {
        if (dmg < 0)
        {
            player = !player;
        }

        string atkMonster = player ? "HMonsterImg" : "MMonsterImg";
        string defMonster = player ? "MMonsterImg" : "HMonsterImg";

        GameObject playerObj = GameObject.Find(atkMonster);

        if (dmg > 0)
        {
            Debug.Log("Damage: " + dmg.ToString());

            CharacterActionController atk = GameObject.Find(atkMonster).GetComponent <CharacterActionController>();
            CharacterActionController def = GameObject.Find(defMonster).GetComponent <CharacterActionController>();

            int buff = atk.buff;
            atk.RemoveBuff();
            dmg += buff;
            buff = def.buff;
            dmg -= buff;
            def.RemoveBuff();

            if (dmg < 0)
            {
                dmg = 0;
            }

            Debug.Log("Damage w/ Buff: " + dmg.ToString());

            atk.CharacterIsHitting(player);
            def.CharacterHit(player);
            def.showDamage(dmg);
        }
        else
        {
            Debug.Log("Healing: " + (dmg * -1).ToString());
            GameObject.Find(defMonster).GetComponent <CharacterActionController>().showDamage(dmg);
        }

        //string hBar = player ? "MOverlay" : "HOverlay";

        //int health = GameObject.Find(hBar).GetComponent<Progress>().progress;
        //health -= dmg;
        //health = health >= 0 ? health : 0;
        //int mxHlth = GameObject.Find(hBar).GetComponent<Progress>().MAX_HEALTH;
        //health = health < mxHlth ? health : mxHlth;
        //GameObject.Find(hBar).GetComponent<Progress>().UpdateProgress(health);
        //if (health == 0)
        //{
        //  PanelManager.instance.DelayedUpdateFromTile(!player);
        //}
        StartCoroutine(HitCharChangeHlth(player, dmg));
    }
 protected override void Init()
 {
     ActionController = new CharacterActionController();
     if (Iso2DMovement == null)
         Iso2DMovement = new Iso2DMovementController();
     MovementController = Iso2DMovement;
     AnimationController = new AnimatorCollectionWrapper(gameObject);
     anim = new AnimationSwapAnimatorWrapper(gameObject);
     Debug.Log("Start");
 }
Exemplo n.º 3
0
    void Start()
    {
        settings = GOD.Instance.Settings.molotov;

        if(settings == null)
            Debug.Log("settings in " + gameObject.name + " is null");

        characterController = GameObject.Find("Character").GetComponent(typeof(CharacterActionController)) as CharacterActionController;

        if(characterController == null)
            Debug.Log("characterController in " + gameObject.name + " is null");
    }
Exemplo n.º 4
0
 public ActionController()
     : base()
 {
     _characterActionController = new CharacterActionController();
 }
 void Awake()
 {
     refrence = this;
 }
Exemplo n.º 6
0
 public ActionController() : base()
 {
     _characterActionController = new CharacterActionController();
 }