Пример #1
0
    /**
     * Game Logic Methods
     */
    public void RespawnPlayer()
    {
        //score, collected, dead objects
        //player health, energy, position, velocity, angular vel.
        this.score = this.state.getScore();
        ArrayList                collectedList = this.state.getCollected();
        List <GameObject>        saveCollected = collectedList.Cast <GameObject>().ToList();
        List <GameObject>        curCollected  = Flatten(this.collected).Cast <GameObject>().ToList();
        IEnumerable <GameObject> enables       = curCollected.Except(saveCollected);

        ship.Health     = this.state.getHealth();
        ship.BeamEnergy = this.state.getBeamenergy();
        foreach (GameObject obj in enables)
        {
            obj.SetActive(true);
        }
        this.collected = TagLookupTable(collectedList);
        ship.gameObject.transform.position = this.checkpoint;
        ship.gameObject.GetComponent <Rigidbody>().velocity        = Vector3.zero;
        ship.gameObject.GetComponent <Rigidbody>().angularVelocity = Vector3.zero;
        ship.Respawn();
        /*GUIMan.UpdateHealthBar (ship.Health, ship.MaxHealth);*/
        GUIMan.UpdateCollectedMolecules(Flatten(collected));
    }