コード例 #1
0
    IEnumerator UnlockPlayerBombing(DropBomb db, float time)
    {
        float timer = time;

        while (timer > 0f)
        {
            timer -= Time.deltaTime;
            yield return(null);
        }
        db.enabled = true;
    }
コード例 #2
0
    void SetPlayers(Color[] colors)
    {
        for (int i = 0; i < colors.Length; i++)
        {
            if (colors [i].a == 0f)
            {
                // no color for this player = no player
                uiCanvas.FindChild("PlayerPanel" + (i + 1)).gameObject.SetActive(false);
                continue;
            }
            else
            {
                int        j = i + 1;
                GameObject p = Instantiate(playerPrefab) as GameObject;
                p.transform.name   = "Player" + j;
                p.transform.parent = level.transform;
                PlayerController pc = p.GetComponent <PlayerController> ();
                pc.SetID(j);
                pc.color = colors [i];
                p.transform.localPosition = spawnPoint [i];
                p.transform.localScale    = Vector3.one * playerScale;
                switch (i)
                {
                case 0: p.transform.Rotate(0, 0, 45f);
                    break;

                case 1: p.transform.Rotate(0f, 0f, -135f);
                    break;

                case 2: p.transform.Rotate(0f, 0f, -45f);
                    break;

                case 3: p.transform.Rotate(0f, 0f, 135f);
                    break;
                }
                p.GetComponent <Respawn>().respawner = respawner;
                respawner.AddPlayer(p.transform, i);
                DropBomb db = p.GetComponent <DropBomb>();
                db.level = level.transform;
                StartCoroutine(UnlockPlayerBombing(db, timeBeforeStarting));
                GameObject    uiPanel  = uiCanvas.Find("PlayerPanel" + j).gameObject;
                MatchPlayerUI playerui = uiPanel.GetComponent <MatchPlayerUI>();
                playerui.player = pc;
                playerui.mode   = defaultType;
                uiPanel.GetComponent <Image>().color = pc.color;
                control.AddPlayer(pc);
            }
        }
    }
コード例 #3
0
ファイル: PlayerManager.cs プロジェクト: JACK1416/unity-
    public void Setup()
    {
        movement = instance.GetComponent <Movement>();
        dropBomb = instance.GetComponent <DropBomb>();

        movement.playerNumber = playerNumber;
        dropBomb.playerNumber = playerNumber;

        playerColorText = "<color=#" + ColorUtility.ToHtmlStringRGB(playerColor) + ">PLAYER " + playerNumber + "</color>";

        SkinnedMeshRenderer[] renderers = instance.GetComponentsInChildren <SkinnedMeshRenderer>();

        for (int i = 0; i < renderers.Length; i++)
        {
            // ... set their material color to the color specific to this tank.
            renderers[i].material.color = playerColor;
        }
    }
コード例 #4
0
 void Start()
 {
     respawnScript  = gameObject.GetComponent <Respawn> ();
     dropBombScript = gameObject.GetComponent <DropBomb> ();
 }