Ejemplo n.º 1
0
 // Use this for initialization
 void Awake()
 {
     uiScript      = FindObjectOfType <IngameUIScript>();
     defaultColour = gameObject.transform.GetChild(0).GetChild(0).GetChild(0).gameObject.GetComponent <MeshRenderer>().material.color;
     renderer      = gameObject.transform.GetChild(0).GetChild(0).GetChild(0).gameObject.GetComponent <Renderer>();
     playerMove    = gameObject.GetComponent <WheelDrive>();
     rb            = gameObject.GetComponent <Rigidbody>();
 }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     touchControl  = GameObject.Find("PlayerManager").GetComponent <TouchControl>();
     playerManager = GameObject.Find("PlayerManager").GetComponent <PlayerManager>();
     tileManager   = GameObject.Find("TileManager").GetComponent <TileManager>();
     gridManager   = GameObject.Find("GridManager").GetComponent <GridManager>();
     ingameUI      = GameObject.Find("IngameUI").GetComponent <IngameUIScript>();
 }
Ejemplo n.º 3
0
    void Awake()
    {
        gridManager   = GameObject.Find("GridManager").GetComponent <GridManager>();
        buildManager  = GameObject.Find("BuildManager").GetComponent <BuildManager>();
        playerManager = GameObject.Find("PlayerManager").GetComponent <PlayerManager>();
        tileManager   = GameObject.Find("TileManager").GetComponent <TileManager>();
        towerManager  = GameObject.Find("TowerManager").GetComponent <TowerManager>();
        ingameUI      = GameObject.Find("IngameUI").GetComponent <IngameUIScript>();

        if (mShowDebugLine)
        {
            GameObject go = new GameObject("DebugLine");
            go.transform.parent = transform;
            mDebugLine          = go.AddComponent <LineRenderer>();
            mDebugLine.material = new Material(Shader.Find("Mobile/Particles/Additive"));
            mDebugLine.SetColors(mLineColor, mLineColor);
            mDebugLine.SetVertexCount(2);
            mDebugLine.SetWidth(0.01f, 0.01f);
            mDebugLine.enabled = false;
        }
    }
Ejemplo n.º 4
0
    //Call this when the player collects the item
    //destroy the item, and reset the spawner
    public void Collect(int a_playerIndex = 0)
    {
        isSpawned        = false;
        isPickedUp       = true;
        timeUntilRespawn = Random.Range(minRespawnTime, maxRespawnTime);

        Destroy(gameObject.transform.GetChild(0).gameObject);

        //loading InGameUIScript here just in case it hasn't been loaded
        if (inGameUIScript == null)
        {
            inGameUIScript = FindObjectOfType <IngameUIScript>();
        }

        inGameUIMultiScript = FindObjectOfType <IngameUIMultiScript>();

        //tell the ui that you've collected this item type (MOVE THIS LINE INTO WHERE THE PLAYER COLLECTS IT)
        //check if we are in Multi or Single mode by checking if the script is active
        GameStateID currState = GameObject.Find("GameManager").GetComponent <GameStateManagerScript>().currState;

        //if we are playing single play mode
        if (currState == GameStateID.InGame)
        {
            //set single play mode's IngameUI to change the item icon
            inGameUIScript.SetCollectedItem(currActivatedItemNum);
        }

        //if we are playing multi play mode
        if (currState == GameStateID.InGameMuilti)
        {
            //set multi play mode's IngameUI to change the item icon
            inGameUIMultiScript.SetCollectedItem(currActivatedItemNum, a_playerIndex);
        }

        totalPickedUpTimes++;
    }
Ejemplo n.º 5
0
 void Start()
 {
     gridManager = GameObject.Find("GridManager").GetComponent <GridManager>();
     ingameUI    = GameObject.Find("IngameUI").GetComponent <IngameUIScript>();
 }