Exemplo n.º 1
0
    public static bool PlayerSpawned = false;              //Player has spawned

    private void Start()
    {
        //If the player has been spawned
        if (PlayerSpawned)
        {
            Debug.Log("Setting up player in new scene");
            //Call the event to set the character's position
            setPlayerPosEvent.Raise(transform);

            //Call the event to start up the player
            startPlayerEvent.Raise();
        }
        else
        {
            if (SelectedCharacter == null)
            {
                //Set the default character to be the selected character
                SelectedCharacter = defaultCharacter;
            }

            //Spawn the player prefab
            GameObject playerObject = Instantiate(SelectedCharacter.characterObject, transform.position, transform.rotation);

            //Set the player object not to be destroyed on load
            DontDestroyOnLoad(playerObject);

            PlayerSpawned = true;
        }
    }
Exemplo n.º 2
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        GUI.enabled = Application.isPlaying;

        TransformEvent e = target as TransformEvent;

        if (GUILayout.Button("Raise"))
        {
            e.Raise(value);
        }
    }
Exemplo n.º 3
0
    public void StartLevel()
    {
        //Set up the player UI
        setMaxHealthEvent.Raise((int)maxHealth.Value);
        setMaxManaEvent.Raise((int)maxMana.Value);
        setManaEvent.Raise(mana);
        setHealthEvent.Raise(health);
        setScoreEvent.Raise(score);

        //Link the player inventory to any relevant components
        inventoryEvent.Raise(inventory);

        //Set up the reference to the camera
        setCameraRefEvent.Raise(cameraTarget);
    }