コード例 #1
0
    void GiveColor(string newColor, string prevColor, string playerName)
    {
        PlayersList.GiveColor(newColor, prevColor, playerName);
        //Debug.Log(newColor + "is taken by someone.");

        GameObject player = PlayersList.GetPlayer(playerName);

        int   index = Array.IndexOf(COLORS, newColor);
        Color color = colors[index];

        // Change the color
        //Material BodyMat = player.GetComponentInChildren<MeshRenderer>().material;
        //BodyMat.color = color;
    }
コード例 #2
0
    void Kill(string killersName, string targetsName)
    {
        GameObject target = PlayersList.GetPlayer(targetsName);
        GameObject killer = PlayersList.GetPlayer(killersName);

        // No Animations Yet :(
        //Animator targetsAnimator = target.GetComponentInChildren<Animator>();
        //targetsAnimator.SetTrigger("dead");

        // Disable SpriteRenderer only if i am not the target.
        if (target != PlayersList.GetMyPlayer())
        {
            target.GetComponentInChildren <MeshRenderer>().enabled = false;

            // Set State of the target to dead if its not my player
            target.GetComponent <Player>().myState = Player.State.dead;
        }
        else
        {
            target.GetComponent <Player>().ThisPlayerDead();
        }

        // Spawm DeadBody rename it to targets name.
        Vector3    offset   = new Vector3(0, -0.3f, 0);
        GameObject deadbody = Instantiate(deadBodyPrefab, target.transform.position + offset, Quaternion.identity);

        deadbody.name = targetsName;

        // Show death animations here, if needed.

        // Change targets collider to trigger
        target.GetComponent <CapsuleCollider>().isTrigger = true;

        // Teleport killer to targets position
        killer.transform.position = target.transform.position;


        /** If u want to write a custom position synchronization script.
         * Might help:
         *  https://doc.photonengine.com/en-us/pun/current/gameplay/synchronization-and-state
         *  https://forum.photonengine.com/discussion/13140/teleport-like-abilities-while-using-photon-transform-view
         **/
    }
コード例 #3
0
    public void Vent_Out(string name)
    {
        GameObject player = PlayersList.GetPlayer(name);

        StartCoroutine(CR_Vent_Out(player));
    }
コード例 #4
0
    public void Vent_In(string name, Vector3 ventPos)
    {
        GameObject player = PlayersList.GetPlayer(name);

        StartCoroutine(CR_Vent_In(player, ventPos, 0.7f));
    }