コード例 #1
0
ファイル: DeathBorder.cs プロジェクト: Tomvhe/Sweet-Victory
    private void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Player")
        {
            var damageableBehaviour = other.GetComponentInChildren <DamageableBehaviour>();
            if (damageableBehaviour == null)
            {
                damageableBehaviour = other.GetComponentInParent <DamageableBehaviour>();
            }

            int playerID = damageableBehaviour.configuration.playerID;

            Debug.Log(string.Format("Player {0}'s {1} entered trigger", playerID, other.name));

            if (damageableBehaviour.IsAlive)// && respawning[playerID] == false)
            {
                respawning[playerID] = true;

                damageableBehaviour.configuration.SubtractLives(1, new DamageChangeInfo());

                playerPool.DeSpawn(playerID);
            }

            return;
        }
        else if (other.tag == "Object")
        {
            other.transform.position = levelManager.CurrentLevel.RandomSpawnPoint();
            return;
        }
    }