public void takeDamage(float v)
 {
     if (isDead)
     {
         return;
     }
     health -= v;
     if (health <= 0)
     {
         isDead = true;
         if (EffectDirector.instance != null)
         {
             EffectDirector.instance.playInPlace(transform.position, StaticStrings.SKULL);
         }
         health = 0;
         TD_Character c = GetComponent <TD_Character>();
         if (c != null)
         {
             if (c.getBall())
             {
                 c.haveBall(false);
                 TD_PancakeBall.instance.loseBall();
             }
             c.Dead(true);
         }
     }
 }
 private void OnTriggerEnter(Collider other)
 {
     if (isTaked)
     {
         return;
     }
     if (other.tag == StaticStrings.AI || other.tag == StaticStrings.player ||
         other.tag == StaticStrings.helper || other.tag == StaticStrings.cpu)
     {
         TD_Character c = other.GetComponent <TD_Character>();
         if (c != null)
         {
             isTaked = true;
             c.haveBall(true);
             possessorTm = c.team;
             gm.GivePossessor(c.team);
             takeIn_Hand(c.getHand());
             if (onTakingBall != null)
             {
                 onTakingBall(possessorTm, other.transform);
             }
             else
             {
                 Debug.Log("on taking ball is null");
             }
         }
     }
 }
        //カメラ移動、ゲームのリセット、ダンス
        IEnumerator pointShow(Team t)
        {
            if (Soundmanager.instance != null)
            {
                Soundmanager.instance.PlaySeByName("RefereeWhistle");
            }
            foreach (var v  in resettableObjects)
            {
                TD_Character c = v.GetComponent <TD_Character>();
                if (c != null)
                {
                    c.block();
                }
            }
            yield return(new WaitForSeconds(1));

            if (Soundmanager.instance != null)
            {
                Soundmanager.instance.musicPause();
            }
            followCamera.SetActive(false);
            _camera.SetActive(true);
            yield return(new WaitForSeconds(1));

            if (t == playerA.t)
            {
                danceCheck(Ymascotte);
                _camera.transform.position = camPositions[0].position;
            }
            else
            {
                danceCheck(Bmascotte);
                _camera.transform.position = camPositions[1].position;
            }

            yield return(new WaitForSeconds(5));

            goTonextGame();
            yield return(resetStatus());

            yield return(new WaitForSeconds(0.5f));

            followCamera.SetActive(true);
            _camera.SetActive(false);
            canMakePoint = true;
            if (Soundmanager.instance != null)
            {
                Soundmanager.instance.musicResume();
            }
        }
 public IEnumerator resetStatus()
 {
     foreach (var item in resettableObjects)
     {
         if (!item.activeInHierarchy)
         {
             item.gameObject.SetActive(true);
         }
         TD_Character c = item.GetComponent <TD_Character>();
         if (c != null)
         {
             c.reset();
         }
     }
     yield return(null);
 }
Example #5
0
 public void addCharacter(TD_Character c)
 {
     characterList.Add(c.gameObject);
 }