예제 #1
0
    /// <summary>
    /// Spawns the character at the selected entry point if there's one, or at the selected checkpoint.
    /// </summary>
    protected override void RegularSpawnSingleCharacter()
    {
        PointsOfEntryStorage point = GameManager.Instance.GetPointsOfEntry(SceneManager.GetActiveScene().name);

        if ((point != null) && (PointsOfEntry.Length >= (point.PointOfEntryIndex + 1)))
        {
            Players[0].RespawnAt(PointsOfEntry[point.PointOfEntryIndex], point.FacingDirection);
            return;
        }

        if (spawnAtFirstCheckPoint && CurrentCheckPoint != null)
        {
            CurrentCheckPoint.SpawnPlayer(Players[0]);
            return;
        }
    }
예제 #2
0
        /// <summary>
        /// Spawns multiple playable characters into the scene
        /// </summary>
        protected override void SpawnMultipleCharacters()
        {
            PointsOfEntryStorage point = GameManager.Instance.GetPointsOfEntry(SceneManager.GetActiveScene().name);
            int  checkpointCounter     = 0;
            int  characterCounter      = 1;
            bool spawned = false;

            foreach (Character player in Players)
            {
                if (AutoAttributePlayerIDs)
                {
                    player.SetPlayerID("Player" + characterCounter);
                }

                player.name += " - " + player.PlayerID;

                // entry point spawn
                if (point != null)
                {
                    Players[characterCounter - 1].RespawnAt(PointsOfEntry[point.PointOfEntryIndex], Character.FacingDirections.Right);
                    spawned = true;
                    characterCounter++;
                }

                if (!spawned && Checkpoints.Count > checkpointCounter + 1)
                {
                    if (Checkpoints[checkpointCounter] != null)
                    {
                        Checkpoints[checkpointCounter].SpawnPlayer(player);
                        characterCounter++;
                        spawned = true;
                        checkpointCounter++;
                    }
                }

                if (!spawned)
                {
                    Checkpoints[checkpointCounter].SpawnPlayer(player);
                    characterCounter++;
                }
            }
        }