Exemple #1
0
        // Use this for initialization
        void Start()
        {
            IsometricPlayer player = (IsometricPlayer)GameObject.FindObjectOfType(typeof(IsometricPlayer));

            if (player)
            {
                Constraint constraint = player.GetComponent <Constraint>();
                if (constraint)
                {
                    constraint.resizeXZ(xAxis, zAxis);
                }
            }

            Music music = (Music)GameObject.FindObjectOfType(typeof(Music));

            if (music)
            {
                music.playMusic(musicClip, 1f);
            }
            LightChanger lc = (LightChanger)GameObject.FindObjectOfType(typeof(LightChanger));

            if (lc)
            {
                lc.changeColor(lightColor);
            }
        }
        public override void init()
        {
            IsometricPlayer player = gameObject.GetComponentInParent <IsometricPlayer>();

            if (player)
            {
                player.moveSpeed += moveSpeedBonus;
            }
        }
 public void OnTriggerEnter(Collider col)
 {
     if (col.name.Equals(playerGameObjectName))
     {
         //lets grab our isometric player script, if we find it, lets activate that gun and destroy ourself
         IsometricPlayer player = (IsometricPlayer)GameObject.FindObjectOfType(typeof(IsometricPlayer));
         if (player)
         {
             player.activeSecondaryGun(gunIndex);
         }
         m_delayedDestroy = true;
     }
 }
Exemple #4
0
        public void Update()
        {
            //WeaponInventory wi = (WeaponInventory)GameObject.FindObjectOfType(typeof(WeaponInventory));
            GameObject gameObject = GameObject.Find("Player");

            if (gameObject)
            {
                IsometricPlayer player = gameObject.GetComponentInChildren <IsometricPlayer>();
                if (player)
                {
                    Weapon weapon = player.getCurrentWeapon();
                    if (ammoText)
                    {
                        if (weaponImage)
                        {
                            weaponImage.sprite = weapon.weaponTexture;
                        }

                        if (weapon)
                        {
                            string postFix = "<color=green> ∞</color>";
                            if (weapon.infiniteAmmo == false)
                            {
                                postFix = "<size=12><color=green> x" + weapon.currentNomClips + "</color></size>";
                            }

                            if (weapon.isEmpty() == false)
                            {
                                if (weapon.getReloading() == false)
                                {
                                    ammoText.text = weapon.getBulletsAsString() + postFix;
                                }
                                else
                                {
                                    ammoText.text = "Reloading";
                                }
                            }
                            else
                            {
                                ammoText.text = "Empty";
                            }
                        }
                        else
                        {
                            ammoText.text = "";
                        }
                    }
                }
            }
        }
Exemple #5
0
        public void onEnemyDie(GameObject go)
        {
            IsometricPlayer IsometricPlayer = gameObject.GetComponentInParent <IsometricPlayer>();

            if (IsometricPlayer)
            {
                float r = Random.Range(0, 100);

                if (r < chanceToReloadSecondaryWeapon)
                {
                    BaseGameManager.floatText("LUCKY RELOAD", go, Color.yellow);
                    Weapon weapon = IsometricPlayer.getCurrentWeapon();
                    if (weapon && weapon.infiniteAmmo == false)
                    {
                        weapon.reload();
                    }
                }
            }
        }