Exemple #1
0
    private void RespawnObjectRPC(NetworkViewID spawnPointOwner, int spawnPointID)
    {
        //Debug.Log("RespawnObjectRPC received.");

        GameObject      spawnPoint = base.GetObject(spawnPointOwner, spawnPointID);
        PlayerRespawner respawner  = spawnPoint.GetComponent <PlayerRespawner>();

        respawner.Respawn();
    }
    void Start()
    {
        // TIDYME: 2018-07-08: Use property, rather than GetComponent
        respawner = GetComponent <CameraFollowPlayer>().followObj.GetComponent <PlayerRespawner>();

        if (respawner == null)
        {
            Debug.Log("Respawner is null in the object the camera is following!!");
        }
    }
Exemple #3
0
        void ClickedWarp(object ctx)
        {
            PlayerRespawner activeInstance = PlayerRespawner.GetActiveInstance();

            if (activeInstance != null)
            {
                base.Owner.Hide();
                activeInstance.ForceRespawn();
            }
        }
 public static PlayerRespawner GetActiveInstance()
 {
     for (int i = PlayerRespawner.allRespawners.Count - 1; i >= 0; i--)
     {
         PlayerRespawner playerRespawner = PlayerRespawner.allRespawners[i];
         if (playerRespawner.ent != null && !playerRespawner.ent.InactiveOrDead && !playerRespawner.inForceRespawn)
         {
             return(playerRespawner);
         }
     }
     return(null);
 }
 public void RpcDie()
 {
     hasControl = false;
     characterController.enabled = false;
     Instantiate(deathParticleSystemObject, gameObject.transform.position, gameObject.transform.rotation);
     isAlive = false;
     mesh.SetActive(false);
     playerRespawner = FindObjectOfType <PlayerRespawner>();
     if (playerRespawner != null)
     {
         playerRespawner.CmdRespawn(gameObject);
     }
 }
        /// <summary>
        ///		Gets called when the Player changes state
        /// </summary>
        public override void OnContextChange()
        {
            // Player just died

            // Change the sprite of the player
            this.Context.SetSprite(this.Context.BatchName, SpriteEntityManager.Self.Find(Sprite.Name.DeadPlayer));
            this.deathSound.Play();

            // Create the respawner
            PlayerRespawner respawner = new PlayerRespawner();

            // Add self to the timer
            TimedEventManager.Active.Create(this, respawner.RespawnWait * 0.5f);
        }
    // Use this for initialization
    void Start()
    {
        WallBuilder     = transform.GetComponent <CorriderWallBuilder>();
        PlayerRespawner = transform.GetComponent <PlayerRespawner>();


        if (WallBuilder)
        {
            WallWidth  = WallBuilder.WallWidth;
            WallHeight = WallBuilder.WallHeight;
        }

        coroutine_enemySpawn    = StartCoroutine(SpawnEnemyCube(spawn_delay));
        coroutine_enemyRedSpawn = StartCoroutine(SpawnEnemyRedCube(spawn_red_delay));
    }
Exemple #8
0
        void Start()
        {
            characterSounds = GetComponentInChildren <CharacterSounds>();
            _characterInput = GetComponent <PlatformerCharacter2D>();

            if (IsPlayer)
            {
                respawner = GetComponent <PlayerRespawner>();
            }

            if (SpawnUponDeath != null)
            {
                spawnUponDeathScale = this.transform.localScale;
            }
        }
 protected override void Initialize()
 {
     if (!GlobalSettings.SinglePlayer)
     {
         PlayerRespawner[] respawnpoints = FindObjectsOfType<PlayerRespawner>();
         foreach (PlayerRespawner spawner in respawnpoints)
             if (spawner.gameObject.layer == gameObject.layer)
             {
                 RespawnPoint = spawner;
                 break;
             }
     }
     else
         this.RespawnPoint = GameObject.Find("Spawnpoint_Player1").GetComponent<PlayerRespawner>();
 }
Exemple #10
0
 protected override void Initialize()
 {
     if (!GlobalSettings.SinglePlayer)
     {
         PlayerRespawner[] respawnpoints = FindObjectsOfType <PlayerRespawner>();
         foreach (PlayerRespawner spawner in respawnpoints)
         {
             if (spawner.gameObject.layer == gameObject.layer)
             {
                 RespawnPoint = spawner;
                 break;
             }
         }
     }
     else
     {
         this.RespawnPoint = GameObject.Find("Spawnpoint_Player1").GetComponent <PlayerRespawner>();
     }
 }
Exemple #11
0
        protected override bool DoShow(MenuScreen <PauseMenu> previous)
        {
            GuiContentData guiContentData = new GuiContentData();

            guiContentData.SetValue("showMap", base.Owner._mapWindow.CanShow(base.Owner.currEnt));
            bool flag = !PlayerRespawner.RespawnInhibited() && PlayerRespawner.GetActiveInstance() != null;

            guiContentData.SetValue("canWarp", flag);
            if (flag)
            {
                IDataSaver saver = base.Owner._saver.GetSaver("/local/start", true);
                if (saver != null)
                {
                    guiContentData.SetValue("hasWarpTgt", true);
                    guiContentData.SetValue("warpTgt", saver.LoadData("level"));
                }
                else
                {
                    guiContentData.SetValue("hasWarpTgt", false);
                }
            }
            base.Root.ApplyContent(guiContentData, true);
            return(true);
        }
 public override void OnStartServer()
 {
     playerRespawner = FindObjectOfType <PlayerRespawner>();
 }
 void Start()
 {
     respawner = (PlayerRespawner)FindObjectOfType(typeof(PlayerRespawner));
 }
Exemple #14
0
 void Start()
 {
     player = GameObject.FindWithTag("Player").GetComponent<PlayerController>();
     playerRespawner = player.GetComponent<PlayerRespawner>();
 }
Exemple #15
0
 void Awake()
 {
     audioSource = GetComponent <AudioSource>();
     respawner   = GetComponent <PlayerRespawner>();
 }
Exemple #16
0
 // Use this for initialization
 void Start()
 {
     Instance = this;
 }
Exemple #17
0
 private void Start()
 {
     respawner   = GameObject.Find("PlayerRespawner").GetComponent <PlayerRespawner>();
     musicplayer = GameObject.Find("Music Player").GetComponent <MusicPlayer>();
 }