Beispiel #1
0
    //public GameObject[] tailPrefab;

    // Use this for initialization
    private void Start()
    {
        tailObjects.Add(gameObject);
        manager = GameObject.Find("GameController").GetComponent <SnakeGameManager>();
        sm      = FindObjectOfType <MJ.SoundManager>();
        combo   = FindObjectOfType <Combo>();
    }
    private void Awake()
    {
        sgm = SnakeGameManager.Instance;

        if (sgm == null)
        {
            Debug.Log("Failed to retrieve Game manager.");
        }
    }
Beispiel #3
0
    public override void OnStartServer()
    {
        sgm = SnakeGameManager.Instance;

        if (sgm == null)
        {
            Debug.Log("Couldn't find Game Manager");
            return;
        }
        maxBoxes      = sgm.GetMaxBoxes();
        spawnInterval = sgm.GetBoxSpawnInterval();
        halfWidth     = sgm.GetX();
        halfHeight    = sgm.GetY();
        //InvokeRepeating("SpawnBoxes", 0, spawnInterval);
    }
    void Start()
    {
        spc              = GetComponent <SnakePlayerController>();
        controllerPanel  = GameObject.Find("ControllerPanel");
        controllerHolder = GameObject.Find("ControllerHolder");

        sgm = SnakeGameManager.Instance;
        if (sgm == null)
        {
            Debug.Log("Failed to retrieve game manager.");
        }

        // Enable the player controller script if it is the local player
        if (isLocalPlayer)
        {
            spc.enabled = true;
            controller.SetActive(true);
            canvasController.SetActive(true);
        }

        else
        {
            spc.enabled = false;
            canvasController.SetActive(false);
        }

        if (isServer)
        {
            if (controllerPanel != null)
            {
                controllerPanel.SetActive(false);
            }
            controller.gameObject.transform.localScale = new Vector3(0, 0, 0);
        }

        // TODO : Transfert user name from lobby
        // Instantiate the text object which holds the player's name/username
        Transform canvas = GameObject.Find("PlayerNames").transform;

        nameTag = Instantiate(nameTag, canvas);

        nameTag.text = playerName;

        // Parent the controller to the Controller object which is a child of the main canvas
        //controller.transform.SetParent(controllerHolder.transform);
        //controller.transform.position.Set(0, 0, 0);
    }
 public void Awake()
 {
     instance = this;
 }
 void Awake()
 {
     Instance       = this;
     this.manager   = this.GetComponent <NetworkManager>();
     timerText.text = "";
 }
 private void Awake()
 {
     instance = this;
 }
 private void Awake()
 {
     bodyHolder       = new GameObject("Player").transform;
     transform.parent = bodyHolder;
     sgm = SnakeGameManager.Instance;
 }