Example #1
0
 // Use this for initialization
 void Start()
 {
     buttonZ         = new Slowtime();
     buttonX         = new NormalizeTime();
     buttonLeftMouse = new FireWeapon();
     buttonESC       = new PauseGame();
 }
Example #2
0
 private void Start()
 {
     if (projectile != null && gun != null)
     {
         weaponToFire           = new FireProjectile(projectile, gun);
         weaponToFire.timeLimit = 0.3f;
     }
 }
Example #3
0
 private void Awake()
 {
     _col            = GetComponent <Collider2D>();
     _fw             = GetComponent <FireWeapon>();
     _st             = GetComponent <SetTrap>();
     _pm             = GameObject.Find("Menu").transform.Find("Pause");
     _controlsScreen = GameObject.Find("Controller Display");
 }
Example #4
0
 // Use this for initialization
 void Start()
 {
     unit   = GetComponent <UnitController>();
     weapon = GetComponent <FireWeapon>();
     player = GameObject.Find("Player").GetComponent <SelfDestruct>();
     assist = FindObjectOfType <FieldOrientationAssistant>();
     //Debug.Log(player);
 }
    private void Awake()
    {
        input = GetComponent <FPSInput>();
        motor = GetComponent <FPSMotor>();
        stats = GetComponent <ActorStats>();
        fire  = GetComponent <FireWeapon>();

        currentMoveSpeed = moveSpeed;
        currentTurnSpeed = turnSpeed;
    }
Example #6
0
    public void OnLanuchWeapon(UInt32 nID)
    {
        FireWeapon FireScript = GetComponent <FireWeapon>();

        if (FireScript != null && FireScript.isActiveAndEnabled)
        {
            FireScript.CastSpell(nID);
            //           Debug.Log(FireScript.gameObject);
        }
    }
Example #7
0
    // public GameObject camerasParent;
    // public GameObject FPSCAMERA;
    //  public float walkSpeed = 4f;
    // public float hRotationSpeed = 100f;
    // public float vRotationSpeed = 80f;
    //  public float sprintSpeed = 8f;

    private void Start()
    {
        //Esconde y bloquea el ratón
        Cursor.visible    = false;
        Cursor.lockState  = CursorLockMode.Locked;
        characterMovement = GetComponent <CharacterMovement>();
        mouseLook         = GetComponent <MouseLook>();
        gunAiming         = GetComponentInChildren <GunAiming>(); //?
        fireWeapon        = GetComponentInChildren <FireWeapon>();
    }
Example #8
0
    void Start()
    {
        dotTexture = (Texture)Resources.Load("Dot");

        pController = gameObject.GetComponent <PlayerController>();
        fWeapon     = gameObject.GetComponent <FireWeapon>();

        escMenu = GameObject.Find("EscMenu");
        escMenu.GetComponent <Canvas>().enabled = false;
    }
Example #9
0
    void Start()
    {
        dotTexture = (Texture)Resources.Load("Dot");

        pController = gameObject.GetComponent<PlayerController>();
        fWeapon = gameObject.GetComponent<FireWeapon>();

        escMenu = GameObject.Find("EscMenu");
        escMenu.GetComponent<Canvas>().enabled = false;
    }
 // Use this for initialization
 void Start()
 {
     buttonZ         = new Slowtime();
     buttonX         = new NormalizeTime();
     buttonLeftMouse = new FireWeapon();
     buttonESC       = new PauseGame();
     buttonSpace     = new JumpCommand();
     buttonLeftShift = new DashCommand();
     buttonB         = new ChangeWeapon();
 }
Example #11
0
    private void Start()
    {
        Cursor.visible   = false;
        Cursor.lockState = CursorLockMode.Locked;

        GameObject.Find("Capsule").GetComponent <MeshRenderer>().enabled = false;

        characterMovement = GetComponent <CharacterMovement>();
        mouseLook         = GetComponent <MouseLook>();
        gunAiming         = GetComponentInChildren <GunAiming>();
        fireWeapon        = GetComponentInChildren <FireWeapon>();
    }
    void OnTriggerEnter(Collider other)
    {
        FireWeapon playerWeapon = other.gameObject.GetComponent <FireWeapon>();

        if (playerWeapon != null)
        {
            playerWeapon.UpdateGrenadeSupply(1);
            //feedback sound
            AudioHelper.PlayClip2D(pickupSound, 1f);
            Destroy(this.gameObject, .25f);
        }
    }
Example #13
0
 void OnTriggerStay(Collider theCollider)
 {
     if (theCollider.gameObject.CompareTag("Fire") && canBeHit)
     {
         canBeHit = false;
         myFireParticle.Play();
         GameObject tempFire = theCollider.gameObject;
         FireWeapon tempWpn  = tempFire.GetComponentInParent <FireWeapon>();
         GetComponent <SimpleHealth>().Damage(1);
         Invoke("ResetHit", Time.deltaTime + tempWpn.bulletDelay);
     }
 }
Example #14
0
    public void PickUpWeapon(FireWeapon weaponPrefab)
    {
        if (weapons[weaponIndex] != null)
        {
            Destroy(weapons[weaponIndex].gameObject);
        }

        FireWeapon newWeapon = Instantiate(weaponPrefab, weaponHolder);

        newWeapon.Init();
        weapons[weaponIndex] = newWeapon;
        EquipWeapon(weaponIndex);
    }
Example #15
0
 public void EquipWeapon(int index)
 {
     CurrentWeapon = weapons[index];
     for (int i = 0; i < weapons.Length; i++)
     {
         if (weapons[i] != null)
         {
             weapons[i].Unequip();
         }
     }
     if (CurrentWeapon != null)
     {
         CurrentWeapon.Equip();
     }
 }
Example #16
0
    // Start is called before the first frame update
    void Start()
    {
        _fw  = GetComponentInParent <FireWeapon>();
        _rea = GetComponentInParent <Reactor>();
        _hm  = GetComponentInParent <HealthManager>();
        _pc  = GetComponentInParent <PlayerController>();

        _shield        = gameObject.transform.Find("Shield").GetComponent <SpriteRenderer>();
        _aimindic      = gameObject.transform.Find("AimIndicator").GetComponent <SpriteRenderer>();
        _bubbleanim    = gameObject.transform.Find("Bubbles").GetComponent <Animator>();
        _bigbubbleanim = gameObject.transform.Find("BigBubble").GetComponent <Animator>();
        _unstbulanim   = gameObject.transform.Find("UnstBulIndicator").GetComponent <Animator>();
        _bouncletanim  = gameObject.transform.Find("BouncletIndicator").GetComponent <Animator>();

        _shield.enabled = false;
    }
Example #17
0
    /*
     * void OnPlayerConnected(NetworkPlayer player)        //obsolete. use unity multiplayer and NetworkIdentity instead
     * {
     *  //NetworkServer.Spawn(startingWeapon);
     * }
     */

    // Update is called once per frame
    void Update()
    {
        if (!isLocalPlayer)
        {
            //return;
        }

        // Active weapon
        FireWeapon fireWeapon = this.transform.Find(currentWeapon + clone).GetComponent <FireWeapon>();

        if (fireWeapon.timer < fireWeapon.timeBetweenBullets || Input.GetButton("Fire1"))            // To change a weapon, current weapon must be ready to fire and player cannot be shooting
        {
            return;
        }

        if (Input.GetButton("Gauntlet"))
        {
            //ChangeWeapon("Gauntlet");
            weaponString = "Gauntlet";
        }

        if (Input.GetButton("Plasma"))
        {
            //ChangeWeapon("Plasma");
            weaponString = "Plasma";
        }

        if (Input.GetButton("RL"))
        {
            //ChangeWeapon("RocketLauncher");
            weaponString = "RocketLauncher";
        }

        if (Input.GetButton("LG"))
        {
            //ChangeWeapon("LG");
            weaponString = "LG";
        }

        if (Input.GetButton("Rail"))
        {
            //ChangeWeapon("Rail");
            weaponString = "Rail";
        }

        ChangeWeapon(weaponString);
    }
Example #18
0
    // Update is called once per frame
    void Update()
    {
        // Active weapon
        FireWeapon fireWeapon = this.transform.GetChild(selectedWeapon).GetComponent <FireWeapon>();

        if (fireWeapon.timer < fireWeapon.timeBetweenBullets || Input.GetButton("Fire1"))            // To change a weapon, current weapon must be ready to fire and player cannot be shooting
        {
            return;
        }


        int previousSelectedWeapon = selectedWeapon;

        if (Input.GetAxis("Mouse ScrollWheel") > 0f)
        {
            if (selectedWeapon >= transform.childCount - 1)
            {
                selectedWeapon = 0;
            }
            else
            {
                selectedWeapon++;
            }
        }

        if (Input.GetAxis("Mouse ScrollWheel") < 0f)
        {
            if (selectedWeapon <= 0)
            {
                selectedWeapon = transform.childCount - 1;
            }
            else
            {
                selectedWeapon--;
            }
        }

        if (previousSelectedWeapon != selectedWeapon)
        {
            SelectWeapon();
        }
    }
    public void InterpretAction(ActorAction action)
    {
        if (action is FireWeapon && attackDelay <= 0 && (!IsPlayer || ammoInClip > 0))
        {
            ammoInClip--;

            attackDelay += Mechanics.Combat.AttackDelay;

            FireWeapon tmp       = action as FireWeapon;
            Vector3    direction = tmp.TargetPoint - ActorsPosition.transform.position;

            Attack att =
                new Attack(
                    Weapon.ProjectileType,
                    Mechanics.Combat.Damage,
                    Mechanics.Combat.DamageVariance,
                    Mechanics.Combat.CriticalChance,
                    Mechanics.Combat.CriticalMultiplicator,
                    ActorsPosition);

            ActorsPosition.CreateRangedAttack(att, direction);

            audioSource.volume = audioSourceVolume * GameRandom.NextFloat(0.9f, 1);
            audioSource.pitch  = GameRandom.NextFloat(0.8f, 1.2f);
            audioSource.Play();
        }

        if (action is MeleeAttack && attackDelay <= 0)
        {
            attackDelay += (action as MeleeAttack).WindUpTime + Mechanics.Combat.AttackDelay;

            StartCoroutine("MeleeAttackWithWindUp", action as MeleeAttack);
        }

        if (action is ReloadWeapon)
        {
            StartCoroutine("StartReloadingAfterDelay");
        }
    }
Example #20
0
    void Attack(UnitController[] targets, IPlayerControl owner)
    {
        List <Transform> trn = new List <Transform>();

        for (int i = 0; i < targets.Length; i++)
        {
            owner.Damage(targets[i], order[index].damage / targets.Length);
            trn.Add(targets[i].transform);
            Debug.Log(order[index].name + " aims at " + targets[i].name);
        }
        if (trn.Count > 0)
        {
            FireWeapon fire = order[index].GetComponent <FireWeapon>();
            //fire.onDone = ()=>NextCombatant();
            fire.Shoot(trn.ToArray(), 3);

            LeanTween.delayedCall(gameObject, 3, () => NextCombatant());
        }
        else
        {
            NextCombatant();
            Debug.Log(order[index].name + " has no targets in range");
        }
    }
Example #21
0
 public void RegisterWeapon(GameObject weapon)
 {
     fireWeapon = weapon.GetComponent <FireWeapon>();
     fireWeapon.RegisterTouchPad(this);
 }
Example #22
0
 public void SetFireWeapon(FireWeapon fireWeapon)
 {
     _fireWeapon = fireWeapon;
 }
Example #23
0
 void Start()
 {
     // Initialisierungen
     fireing = GetComponentInParent <FireWeapon>();
     try { propsManager = GameObject.Find("PropsManager").transform; } catch {}
 }
Example #24
0
 // Start is called before the first frame update
 void Start()
 {
     weapon = GameObject.FindGameObjectWithTag("Player").GetComponent <FireWeapon>();
 }
Example #25
0
 public static void CallFireWeapon(float fuelAmount)
 {
     FireWeapon?.Invoke(fuelAmount);
 }