コード例 #1
0
 void OnTriggerClicked(object sender, ControllerInteractionEventArgs e)
 {
     GameManager.PlayerState s = GameManager.GM.GetState(PlayerManager.Player.photonView.viewID);
     if (s == GameManager.PlayerState.Alive)
     {
         gun.Fire();
     }
 }
コード例 #2
0
ファイル: PlayerManager.cs プロジェクト: mjm973/Illuminated
    // updates ui to reflect numebr of players left
    void UpdateDeathCount()
    {
        Text t = ui.transform.Find("DeathCount").GetComponent <Text>();

        t.font = dispFont;
        GameManager.PlayerState ps = GameManager.GM.GetState(photonView.viewID);

        switch (GameManager.State)
        {
        case GameManager.GameState.Lobby:
            t.transform.localPosition = new Vector3(16, 200, 0);
            t.text     = string.Format("{0} contender(s) waiting", GameManager.GM.NumPlayers());
            t.fontSize = 42;
            t.color    = new Color(1f, 1f, 1f);
            break;

        case GameManager.GameState.Match:
            t.transform.localPosition = new Vector3(16, 200, 0);
            if (ps == GameManager.PlayerState.Alive)
            {
                t.text     = string.Format("{0} of you. Hunt.", GameManager.GM.NumAlive());
                t.fontSize = 42;
                t.color    = new Color(1f, 1f, 1f);
            }
            else if (ps == GameManager.PlayerState.Dead)
            {
                t.text     = string.Format("WEAK! You have been Illuminated");
                t.fontSize = 80;
                t.color    = new Color(1f, 0f, 0f);
            }

            break;

        case GameManager.GameState.Over:
            t.transform.localPosition = new Vector3(16, 64, 0);
            if (ps == GameManager.PlayerState.Over)
            {
                t.text     = string.Format("ILLUMINATED.");
                t.fontSize = 80;
                t.color    = new Color(1f, 0f, 0f);
            }
            else if (ps == GameManager.PlayerState.Winner)
            {
                t.text     = string.Format("SURVIVOR.");
                t.fontSize = 80;
                t.color    = new Color(1f, 0f, 0f);
            }

            break;
        }
    }
コード例 #3
0
    // Use this for initialization
    void Awake()
    {
        // Initialize animator
        _animator = GetComponent <Animator>();

        // Initialize player state variables
        facingRight  = true;
        mPlayerState = GameManager.instance.GetPlayerState();
        // Initialize components
        mPlayerController = GetComponent <PlayerController>();
        // Setting up references.
        slashSpawn   = transform.Find("slashSpawn");
        missileSpawn = transform.Find("missileSpawn");
        scanSpawn    = transform.Find("scanSpawn");
    }
コード例 #4
0
 void Update()
 {
     mPlayerState = GameManager.instance.GetPlayerState(); // Check the player's state from game manager
     if (Input.GetKey(KeyCode.LeftArrow))
     {
         facingRight = false;
     }
     else if (Input.GetKey(KeyCode.RightArrow))
     {
         facingRight = true;
     }
     // Default state of player is ALIVE. They can Scan, Missile, and Slash
     if (mPlayerState == GameManager.PlayerState.ALIVE)
     {
         // Scanning action, currently bound to Z key.
         if (Input.GetButtonDown("Scan"))
         {
             Scan();
         }
         // Magic missile ability, currently bound to X key. Player must be grounded, and time must be past cooldown
         if (Input.GetButtonDown("MagicMissile") && Time.time > mMissileNextFire)
         {
             Missile();
             // Metrics
             GameManager.instance.mPlayerStats.TotalMissilesFired++;
         }
         //   If the slash button is pressed down (C), slash in front of the player
         if (Input.GetButtonDown("Slash") && Time.time > mSlashNextFire)
         {
             Slash();
             GameManager.instance.mPlayerStats.TotalSlashes++;
         }
     }
     // Player is in scanning mode. Must exit scanning.
     else if (mPlayerState == GameManager.PlayerState.SCAN)
     {
         if (Input.GetButtonDown("Scan"))
         {
             mPlayerController.enabled = true; // Enable player controller script to enable movement
             Destroy(scanInstance);
             SoundManager.instance.PlaySingle(mScanClip);
             GameManager.instance.SetPlayerState(GameManager.PlayerState.ALIVE);
         }
     }
 }
コード例 #5
0
 public void TogglePauseState(GameManager.PlayerState newState)
 {
     GameManager.playerState = newState;
     if (GameManager.playerState != GameManager.PlayerState.Playing)
     {
         Cursor.lockState = CursorLockMode.None;
         Cursor.visible   = true;
         _pauseMenu.SetActive(true);
         Time.timeScale = 0;
     }
     else if (GameManager.playerState == GameManager.PlayerState.Playing)
     {
         Cursor.lockState = CursorLockMode.Locked;
         Cursor.visible   = false;
         _pauseMenu.SetActive(false);
         Time.timeScale = 1;
     }
 }
コード例 #6
0
    private static object DeserializePlayerState(byte[] bytes)
    {
        int index = 0;
        short nullFlag;
        float sleepStatus;
        float academicStatus;
        float socialStatus;
        float xLoc;
        float yLoc;
        float zLoc;

        Protocol.Deserialize(out nullFlag, bytes, ref index);

        if (nullFlag == 1)
            { return null; }

        Protocol.Deserialize(out sleepStatus, bytes, ref index);
        Protocol.Deserialize(out academicStatus, bytes, ref index);
        Protocol.Deserialize(out socialStatus, bytes, ref index);
        Protocol.Deserialize(out xLoc, bytes, ref index);
        Protocol.Deserialize(out yLoc, bytes, ref index);
        Protocol.Deserialize(out zLoc, bytes, ref index);

        Vector3 location = new Vector3(xLoc, yLoc, zLoc);

        // Make a team with maxSize player slots
        GameManager.PlayerState state = new GameManager.PlayerState(sleepStatus, academicStatus, socialStatus, location);

        return state;
    }