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

        weaponsSystem.ShipShooting = false;
    }
示例#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;
    }
示例#4
0
文件: Pickup.cs 项目: PidgeV/DSGGames
    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);
        }
    }
示例#5
0
 void Start()
 {
     controller = GetComponent<CharacterController>();
     setBounds();
     init ();
     weaponsSystem = gameObject.AddComponent<WeaponsSystem>();
 }
示例#6
0
 private void OnEnable()
 {
     _weaponsSystem = (WeaponsSystem)target;
     iconStyle.normal.background = _weaponsSystem.defaultTexture;
     showWeapons = new bool[] { false, false, false, false, false };
 }