Example #1
0
 void Start()
 {
     controller = GetComponent <CharacterController>();
     setBounds();
     init();
     weaponsSystem = gameObject.AddComponent <WeaponsSystem>();
 }
Example #2
0
    private void OnEnable()
    {
        if (weaponsSystem == null)
        {
            weaponsSystem = gameObject.GetComponent <WeaponsSystem>();
        }

        weaponsSystem.ShipShooting = false;
    }
Example #3
0
    // Unity Methods and Events
    #region Unity Events and Methods

    /// <summary>
    /// Initialize and Get dependencies
    /// </summary>
    ///
    private void Start()
    {
        if (shieldProjector == null)
        {
            shieldProjector = GetComponentInChildren <ShieldProjector>();
        }

        if (weaponsSystem == null)
        {
            weaponsSystem = gameObject.GetComponent <WeaponsSystem>();
        }

        if (shieldProjector == null)
        {
            shieldProjector = GetComponentInChildren <ShieldProjector>();
        }

        if (playerHUD == null)
        {
            playerHUD = gameObject.GetComponent <PlayerHUDHandler>();
        }

        if (rigidbody == null)
        {
            rigidbody = gameObject.GetComponent <Rigidbody>();
        }

        foreach (Player player in GameObject.FindObjectsOfType <Player>())
        {
            player.FindShip();
        }

        // Set the cameras size and positions
        gunnerCamera.rect = new Rect(0, 0.0f, 1.0f, 0.5f);
        pilotCamera.rect  = new Rect(0, 0.5f, 1.0f, 0.5f);

        gunnerCenter = gunnerslockUI.transform.position;

        boostGauge = myProperties.maxBoostGauge;

        if (!shipHP)
        {
            TryGetComponent(out shipHP);
        }

        if (!audioSource)
        {
            TryGetComponent(out audioSource);
        }

        boostDepleteDelay = myProperties.boostDepleteDelay;
    }
Example #4
0
    private void OnTriggerEnter(Collider other)
    {
        GameObject player = GameObject.FindGameObjectWithTag("Player");

        if (player && other.gameObject.Equals(player)) //If player is found to exist and player is the one colliding
        {
            WeaponsSystem weaponsSystem = player.GetComponent <WeaponsSystem>();
            weaponsSystem.GunController.ammoCount.SetAmmo(weapon, ammoCount);

            if (hitVFX)
            {
                GameObject go = Instantiate(hitVFX, transform.position, Quaternion.identity);
                go.transform.localScale = new Vector3(vfxScale, vfxScale, vfxScale);
            }

            Destroy(gameObject);
        }
    }
Example #5
0
 void Start()
 {
     controller = GetComponent<CharacterController>();
     setBounds();
     init ();
     weaponsSystem = gameObject.AddComponent<WeaponsSystem>();
 }
Example #6
0
 private void OnEnable()
 {
     _weaponsSystem = (WeaponsSystem)target;
     iconStyle.normal.background = _weaponsSystem.defaultTexture;
     showWeapons = new bool[] { false, false, false, false, false };
 }