예제 #1
0
    void Start()
    {
        tf = GetComponent <Transform>();
        rb = GetComponent <Rigidbody>();

        inputHandler = GetComponent <ShipInputHandler>();
        ship         = GetComponent <ShipController>();
    }
예제 #2
0
    void Awake()
    {
        GameObject player = GameObject.FindGameObjectWithTag("Player");

        shipFuelHandler  = player.GetComponent <ShipFuelHandler>();
        hpHandler        = player.GetComponent <HPHandler>();
        shipInputHandler = player.GetComponent <ShipInputHandler>();
    }
예제 #3
0
 public void FindShip()
 {
     // When a player starts the game this grabs an open ship
     foreach (GameObject ship in GameObject.FindGameObjectsWithTag("Player"))
     {
         if (ship.TryGetComponent(out ShipInputHandler shipController))
         {
             Controller = shipController;
             Controller.JoinShip(this);
             break;
         }
     }
 }
    void Awake()
    {
        lineRenderer = GetComponent <LineRenderer>();

        laserHitParticleSystem            = GetComponentInChildren <ParticleSystem>();
        laserParticleSystemEmissionModule = laserHitParticleSystem.emission;

        //Detach the laser particle system from the object it's attached to.
        laserHitParticleSystem.transform.parent = null;

        if (transform.root.CompareTag("Player"))
        {
            isPlayer = true;
        }

        shipInputHandler = GetComponentInParent <ShipInputHandler>();
    }