Beispiel #1
0
    void Update()
    {
        return;

        if (isLoadingGun)
        {
            float        timePressed = Time.time - timePressing;
            Weapon.types newWeawponType;
            if (timePressed < 0.5f)
            {
                newWeawponType = Weapon.types.SIMPLE;
            }
            else if (timePressed < 1f)
            {
                newWeawponType = Weapon.types.DOUBLE;
            }
            else
            {
                newWeawponType = Weapon.types.TRIPLE;
            }
            if (newWeawponType != weawponType)
            {
                weawponType = newWeawponType;
                weapon.OnChangeWeapon(newWeawponType);
            }
            //weapon.Turn (characterBehavior.transform.eulerAngles.y);
        }
    }
Beispiel #2
0
    void OnShoot(Vector3 pos, Weapon.types type)
    {
        float offsetY = characterBehavior.transform.localEulerAngles.y;

        switch (type)
        {
        case Weapon.types.SIMPLE:
            Shoot(pos, offsetY);
            break;

        case Weapon.types.DOUBLE:
            Shoot(new Vector3(pos.x + 1, pos.y, pos.z), -20 + offsetY);
            Shoot(new Vector3(pos.x - 1, pos.y, pos.z), 20 + offsetY);
            break;

        case Weapon.types.TRIPLE:
            if (!Data.Instance.isAndroid)
            {
                Shoot(pos, 0);
            }
            Shoot(new Vector3(pos.x + 1, pos.y, pos.z), -25 + offsetY);
            Shoot(new Vector3(pos.x - 1, pos.y, pos.z), 25 + offsetY);
            break;
        }
    }
Beispiel #3
0
 void OnChangeWeapon(int playerID, Weapon.types type)
 {
     this.weawponType = type;
     if (playerID != characterBehavior.player.id)
     {
         return;
     }
     weapon.OnChangeWeapon(type);
 }
Beispiel #4
0
    public override void OnRestart(Vector3 pos)
    {
        base.OnRestart(pos);
//        int rand = Random.Range(0, 100);
//        if (rand < 33)
//            missileType = Weapon.types.SIMPLE;
//        else if (rand < 66)
//            missileType = Weapon.types.DOUBLE;
//        else
        missileType = Weapon.types.TRIPLE;
        InitWeapon(missileType);
    }
Beispiel #5
0
    public void SetFire(Weapon.types weawponType, float delay)
    {
        if (characterBehavior.state == CharacterBehavior.states.DEAD)
        {
            return;
        }

        if (!characterBehavior.controls.isAutomata)
        {
            Data.Instance.events.OnAvatarShoot(characterBehavior.player.id);
        }

        if (Game.Instance.state != Game.states.PLAYING)
        {
            return;
        }

        //isLoadingGun = false;

        if (!Data.Instance.isAndroid && lastShot + delay > Time.time)
        {
            return;
        }

        //	ResetWeapons ();


        if (characterBehavior.state != CharacterBehavior.states.RUN && characterBehavior.state != CharacterBehavior.states.SHOOT && transform.localPosition.y < 6)
        {
            GetComponent <Rigidbody>().AddForce(new Vector3(0, 400, 0), ForceMode.Impulse);
        }

        characterBehavior.state = CharacterBehavior.states.SHOOT;

        if (characterBehavior.madRoller)
        {
            characterBehavior.madRoller.Play("shoot");
        }

        characterBehavior.shooter.weapon.Shoot();
        Data.Instance.events.OnSoundFX("fire", characterBehavior.player.id);

        lastShot = Time.time;

        Vector3 pos = new Vector3(transform.position.x, transform.position.y + 2.5f, transform.position.z + 4f);

        OnShoot(pos, weawponType);

        Invoke("ResetShoot", delay);
    }
Beispiel #6
0
    void OnChangeWeapon(int _playerID, Weapon.types type)
    {
        if (playerID != _playerID)
        {
            return;
        }

        panel.SetActive(true);

        Sprite texture = Resources.Load <Sprite>("bullets/" + type.ToString());

        image.sprite = texture;

        Invoke("Reset", 1);
    }
    public void InitWeapon(Weapon.types _type)
    {
        ResetAll();
        switch (_type)
        {
        case Weapon.types.SIMPLE:
            simpleShot.SetActive(true);
            break;

        case Weapon.types.DOUBLE:
            doubleShot.SetActive(true);
            break;

        case Weapon.types.TRIPLE:
            tripleShot.SetActive(true);
            break;
        }
    }
Beispiel #8
0
//	public void Turn(float _z)
//	{
//		Vector3 rot = transform.localEulerAngles;
//		rot.z = _z;
//		transform.localEulerAngles = rot;
//	}
    public void OnChangeWeapon(Weapon.types type)
    {
        this.type = type;
        ResetAll();
        switch (type)
        {
        case types.SIMPLE:
            simpleShot.SetActive(true);
            break;

        case types.DOUBLE:
            doubleShot.SetActive(true);
            break;

        case types.TRIPLE:
            tripleShot.SetActive(true);
            break;
        }
    }
Beispiel #9
0
 public void ResetWeapons()
 {
     weapon.ResetAll();
     weawponType = Weapon.types.SIMPLE;
 }