コード例 #1
0
 void Awake()
 {
     // Check if null in prod...
     engines      = GetComponent <Engines>();
     playerAvatar = GetComponent <PlayerAvatar>();
     bulletGun    = GetComponent <BulletGun>();
 }
コード例 #2
0
    private void Update()
    {
        if (this.engines != null)
        {
            float horizontalSpeedPercent = Input.GetAxis("Horizontal");
            float verticalSpeedPercent   = Input.GetAxis("Vertical");

            this.engines.SetSpeed(new Vector2(horizontalSpeedPercent, verticalSpeedPercent));
        }

        if (this.bulletGuns != null)
        {
            for (int index = 0; index < this.bulletGuns.Length; index++)
            {
                BulletGun bulletGun = this.bulletGuns[index];

                if (Input.GetAxis("Fire") > 0f)
                {
                    bulletGun.TryToFire();
                }
            }
        }

        if (this.playerAvatar != null)
        {
            if (Input.GetAxis("SwitchWeapon") > 0f)
            {
                this.playerAvatar.SwitchToNextWeapon();
            }
        }
    }
コード例 #3
0
 void Start()
 {
     avatar    = GameManager.Instance.GetPlayer().GetComponent <PlayerAvatar>();
     maxHealth = avatar.GetMaxHealth();
     bulletGun = avatar.GetComponent <BulletGun>();
     maxEnergy = bulletGun.GetMaxEnergy();
 }
コード例 #4
0
ファイル: Collectibles.cs プロジェクト: SimonLanos/shmup_JIN
    void OnTriggerEnter2D(Collider2D other)
    {
        //Au contact du personnage, on applique les effets du collectable
        PlayerAvatar target = other.GetComponent <PlayerAvatar> ();

        if (target)
        {
            GameManager gameManager = GameObject.FindObjectOfType <GameManager> ();
            if (gameManager)
            {
                if (gameManager.GameModeWithHealth)
                {
                    target.TakeDamage(-healthRecovery);
                    Destroy(gameObject);
                }
                if (!gameManager.GameModeWithHealth)
                {
                    gameManager.BoostCombo(comboBoost);
                    Destroy(gameObject);
                }
            }
            BulletGun bulletGun = other.GetComponent <BulletGun> ();
            if (bulletGun && unlockNextShoot)
            {
                bulletGun.TryUnlockNextShoot();
            }
            if (bulletGun && energyRecovery)
            {
                bulletGun.RefillEnergy();
            }
        }
    }
コード例 #5
0
    // Use this for initialization
    void Start()
    {
        enemyController          = GetComponent <AIEnemyBasicEngine>();
        enemyController.Position = transform.position;

        bulletGun       = GetComponent <BulletGun>();
        bulletGun.Speed = enemyController.Speed * 10;
    }
コード例 #6
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            _bulletGun = GetComponent <BulletGun>();
            _bulletGun.Fire();
        }

        float moveHorizontal = Input.GetAxis("Horizontal");
        float moveVertical   = Input.GetAxis("Vertical");

        _engine.Speed = new Vector2(moveHorizontal, moveVertical);
    }
コード例 #7
0
    public void Fire(string type)
    {
        BulletGun bulletGun = FindBulletGun(type);

        if (bulletGun)
        {
            if (Time.time - lastFire >= rate)
            {
                lastFire = Time.time;
                bulletGun.Fire();
            }
        }
    }
コード例 #8
0
ファイル: BasicAI.cs プロジェクト: QuaintHope/Schmup2018-JIN
    private void Update()
    {
        if (this.engines != null)
        {
            this.engines.SetSpeed(new Vector2(-1f, 0f));
        }

        if (this.bulletGuns != null)
        {
            for (int index = 0; index < this.bulletGuns.Length; index++)
            {
                BulletGun bulletGun = this.bulletGuns[index];

                // Fire all the time !
                bulletGun.TryToFire();
            }
        }
    }
コード例 #9
0
    public void SwitchToNextWeapon()
    {
        if (Time.time < this.lastWeaponSelectionChangeTime + this.weaponSwitchCooldown)
        {
            // Can't change the selected weapon now. It's in cooldown.
            return;
        }

        this.lastWeaponSelectionChangeTime = Time.time;
        this.selectedWeapon = (this.selectedWeapon + 1) % this.weaponsNames.Length;

        for (int index = 0; index < this.bulletGuns.Length; index++)
        {
            BulletGun bulletGun = this.bulletGuns[index];
            if (bulletGun.WeaponName == this.weaponsNames[this.selectedWeapon])
            {
                bulletGun.enabled = true;
            }
            else
            {
                bulletGun.enabled = false;
            }
        }
    }
コード例 #10
0
ファイル: InputController.cs プロジェクト: AlgOnyr/SHMUP-JIN
 private void Start()
 {
     _player    = GameObject.FindGameObjectWithTag("Player");
     _bulletGun = _player.GetComponent <BulletGun>();
     _speed     = _player.GetComponent <PlayerAvatar>().MaxSpeed;
 }
コード例 #11
0
 // Start is called before the first frame update
 void Start()
 {
     engines   = GetComponent <Engines>();
     bulletGun = GetComponent <BulletGun>();
 }
コード例 #12
0
ファイル: InputController.cs プロジェクト: Womps/ShootThemUp
 // Use this for initialization
 void Start()
 {
     this.engine = this.GetComponent <Engines>();
     this.gun    = this.GetComponent <BulletGun>();
 }
コード例 #13
0
 // Start is called before the first frame update
 void Start()
 {
     _engine    = GetComponent <Engines>();
     _bulletGun = GetComponent <BulletGun>();
 }
コード例 #14
0
 void Awake()
 {
     engine    = this.GetComponent <Engines>();
     bulletGun = this.GetComponent <BulletGun>();
 }
コード例 #15
0
ファイル: HUD.cs プロジェクト: Womps/ShootThemUp
 public void Start()
 {
     player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerAvatar>();
     gun    = GameObject.FindGameObjectWithTag("Player").GetComponent <BulletGun>();
 }