// Use this for initialization
    void Start()
    {
        //get game manager
        gameManager = GameObject.Find("GameManager").GetComponent <GameStateManagerScript>();

        //Obtain the player manager
        playerManager = GameObject.Find("Player").GetComponent <PlayerManager>();

        //get entity
        entity = GameObject.FindGameObjectWithTag("Player").transform.GetComponent <PlayerManager>();

        //get rankScript
        rankScript = GameObject.Find("GameManager").GetComponent <RankScript>();

        //get check point script from entities
        checkpointScript = GameObject.FindGameObjectWithTag("Player").transform.GetComponent <CarCheckpointScript>();

        //load sprites for sprites into arrays we created above from Resource folder
        lapSpriteList  = Resources.LoadAll <Sprite>("LapSprites");
        rankSpriteList = Resources.LoadAll <Sprite>("RankSprites");
        itemSpriteList = Resources.LoadAll <Sprite>("ItemIconSprites");

        //get image slots and link to the variables we set up
        lapCountSprite = gameObject.transform.Find("lapCount").GetComponent <Image>();
        rankSprite     = gameObject.transform.Find("rank").GetComponent <Image>();
        itemSprite     = gameObject.transform.Find("itemIcon").GetComponent <Image>();
    }
Exemple #2
0
    // Use this for initialization
    void Awake()
    {
        //Obtain the script properties
        gameManager    = GameObject.Find("GameManager").GetComponent <GameStateManagerScript>();
        rank           = GameObject.Find("GameManager").GetComponent <RankScript>();
        carCheckpoint  = GameObject.FindGameObjectWithTag("Player2").transform.GetComponent <CarCheckpointScript>();
        drive          = GameObject.FindGameObjectWithTag("Player2").transform.GetComponent <WheelDrive>();
        spriteRenderer = GameObject.FindGameObjectWithTag("Player2").transform.GetChild(16).transform.GetComponent <SpriteRenderer>();

        //Don't render the game object
        displayRank.SetActive(false);
    }
 // Use this for initialization
 void Start()
 {
     //get rank script from game manager
     rankScript = GameObject.Find("GameManager").GetComponent <RankScript>();
     //list to store every checkpoint's transform
     checkpointList = rankScript.CheckpointList;
     //Find the CheckpointSet object (parent group of all checkpoint objects)
     checkpointSet = GameObject.FindGameObjectWithTag("CheckpointSet");
     //initialize current lap to 1
     currLap = 1;
     //initialize the checkpoints the entity has traversed to 0
     currCheckpointCount = 0;
     //use entity's current position as start position
     startPos = gameObject.transform.position;
 }