Esempio n. 1
0
	public void Start() {
		Floor floor = Helper.Find<Floor>("Floor");
		gridManager = floor.GridManager;
		unit = GetComponent<BaseUnit>();

		soundEffectPLayer = GetComponentInChildren<SoundEffectPlayer>();

        LeaveSound = unit.GetComponent<BaseUnit>().LeaveSound;
        ArriveSound = unit.GetComponent<BaseUnit>().ArriveSound;

        if (LeaveSound.Any() || ArriveSound.Any())
	    {
            AudioSource audioSrc = gameObject.AddComponent<AudioSource>();
            LeaveArriveEffectPlayer = gameObject.GetComponent<AudioSource>();
	    }
        
	    if (unit is AvatarUnit)
	    {
	        isAvatarMover = true;
            currentAvatarUnit = (AvatarUnit)unit;
	    }
	    else
	    {
	        isAvatarMover = false;
	    }
	}
Esempio n. 2
0
    private IEnumerator StartFalling(bool isAvatar, AvatarUnit currentAvatar)
    {
        if (isAvatar)
        {
            currentAvatar.SetIsFalling();
        }
       
        while (this.transform.position.y > -10)
        {
            this.transform.position = this.transform.position - new Vector3(0, 1, 0);
            yield return new WaitForSeconds(0.03f);
        }

        if (isAvatar)
        {
            currentAvatar.KillAvatar();
        }
        else
        {
            this.DestroyUnit();
        }
        
        yield return 0;
    }