コード例 #1
0
 // Start is called before the first frame update
 void Start()
 {
     //will control direction of bullet based of the direction the player is moving in
     //will not need anything else here
     shoot.velocity = transform.right * thrust;
     //only one instance of these managers
     score  = FindObjectOfType <scoreManager>();
     health = FindObjectOfType <healthManager>();
     sound  = FindObjectOfType <AudioManager>();
 }
コード例 #2
0
 // Start is called before the first frame update
 void Start()
 {
     //get all options for path
     pathPoints = GameObject.Find("TractorPath");
     followThis = pathPoints.GetComponentsInChildren <Transform>();
     //just generate a random spot to move next
     nextMove = RNG();
     //access managers for update on collision
     score  = FindObjectOfType <scoreManager>();
     health = FindObjectOfType <healthManager>();
     sound  = FindObjectOfType <AudioManager>();
 }
コード例 #3
0
    // Start is called before the first frame update
    void Start()
    {
        //find the managers for correct health, score keeping and playing sounds on collision
        score  = FindObjectOfType <scoreManager>();
        health = FindObjectOfType <healthManager>();
        sound  = FindObjectOfType <AudioManager>();

        //give it a random speed
        //gameobjects managed by colliders
        rb          = gameObject.GetComponent <Rigidbody2D>();
        rb.velocity = transform.right * truckSpeed;
    }
コード例 #4
0
 void Awake()
 {
     if (instance)
     {
         Destroy(this.gameObject);
     }
     else
     {
         instance = this;
     }
     UpdateHealth();
 }
コード例 #5
0
    // Start is called before the first frame update
    void Start()
    {
        //set initial speed
        speed = 1.0f;
        //get the path
        pathPoints = GameObject.Find("AmbulancePath");
        //get all options for path
        followThis = pathPoints.GetComponentsInChildren <Transform>();

        //access the managers for functionality
        score  = FindObjectOfType <scoreManager>();
        health = FindObjectOfType <healthManager>();
        sound  = FindObjectOfType <AudioManager>();
    }
コード例 #6
0
    // Use this for initialization
    void Start()
    {
        player = FindObjectOfType <PlayerController> ();

        manager = FindObjectOfType <healthManager> ();
    }
コード例 #7
0
 void Start()
 {
     player    = FindObjectOfType <playerController> ();
     health    = PlayerPrefs.GetInt("CurrentHealth");
     h_manager = FindObjectOfType <healthManager> ();
 }
コード例 #8
0
ファイル: shipController.cs プロジェクト: Solokeh/Opal-Sky
 void Start()
 {
     rb2D   = GetComponent <Rigidbody2D>();
     health = GetComponent <healthManager>();
 }