Esempio n. 1
0
 public void INIT(Transform t)
 {
     player          = t;
     selector        = player.transform.GetComponent <WeaponSelector>();
     render          = GetComponent <MeshRenderer>();
     cameraTransform = GameObject.Find("Camera/Main Camera").transform;
 }
Esempio n. 2
0
 private void Start()
 {
     playerController = FindObjectOfType <PlayerController>();
     mouseLook        = FindObjectOfType <MouseLook>();
     weaponSelector   = FindObjectOfType <WeaponSelector>();
     bonfire          = FindObjectOfType <Bonfire>();
     FindObjectOfType <AudioManager>().Play("Ambient");
     Cursor.visible = false;
 }
    public void Awake()
    {
        _cannonballSpawners = GetComponentsInChildren <CannonballSpawnerPlayer>();
        _bombSpawner        = GetComponentInChildren <BombSpawner>();
        _shipMovement       = GetComponent <ShipMovement>();
        _healthScript       = GetComponent <HealthScript>();

        _weaponSelector = GetComponent <WeaponSelector>();
    }
Esempio n. 4
0
 public void Update()
 {
     if (target != null)
     {
         WeaponSelector temp = gameObject.GetComponent <WeaponSelector>();
         if (temp != null)
         {
             temp.weapons[temp.currentWeapon].SendMessage("OnFire");
         }
     }
 }
Esempio n. 5
0
 private void Start()
 {
     lightBonfireComponent = lightBonfire.GetComponent <Light>();
     startSizeFire         = fire.main.startSize.constant;
     startSizeSmoke        = smoke.main.startSize.constant;
     speed          = intensity / timeBonfireLife;
     player         = GameObject.Find("Player");
     weaponSelector = FindObjectOfType <WeaponSelector>();
     audioSource    = GetComponent <AudioSource>();
     audioSource.PlayOneShot(bonfireSound);
 }
Esempio n. 6
0
    private void OnTriggerEnter(Collider other)
    {
        // does the GameObject that collided with this weapon pickup have a WeaponSelector component?
        WeaponSelector weaponSelector = other.gameObject.GetComponentInChildren <WeaponSelector>();

        // if there is a weaponselector, tell it to mark the matching weapon as collected
        if (weaponSelector != null)
        {
            weaponSelector.CollectWeapon(weaponName);
            gameObject.SetActive(false);
        }
    }
Esempio n. 7
0
    void FixedUpdate()
    {
        velocity = rb.velocity.sqrMagnitude;
        Vector3 acceleration = ComputeThrusts();
        Vector3 torque       = ComputeTorques();

        //if (rb.velocity.magnitude > (stats.TopSpeedStat +1)* 100)
        //{
        //    acceleration = Vector3.zero;
        //}
        acceleration = ModularCap(acceleration);
        rb.AddRelativeForce(acceleration, ForceMode.Acceleration);
        rb.AddRelativeTorque(torque, ForceMode.Acceleration);

        if (Input.GetAxis("Fire1") > 0)
        {
            WeaponSelector temp = gameObject.GetComponent <WeaponSelector>();
            if (temp != null)
            {
                temp.weapons[temp.currentWeapon].SendMessage("OnFire");
            }
        }
    }
 private void Awake()
 {
     wSel = GetComponent <WeaponSelector>();
     anvil.SetActive(false);
     sounds = GetComponent <AudioSource>();
 }
 // Start is called before the first frame update
 void Start()
 {
     players = GetComponent <PLAYERS>();
     wSel    = GetComponent <WeaponSelector>();
 }
 private void Start()
 {
     player         = GameObject.Find("Player");
     weaponSelector = FindObjectOfType <WeaponSelector>();
     audioSource    = GetComponent <AudioSource>();
 }