コード例 #1
0
    // Set up new Weapon
    public void SetUpGun(string tag)
    {
        // Guns
        if (tag == "Default Gun")
        {
            equippedWeapon = guns[0];
        }

        if (tag == "Green Gun")
        {
            // Setting up the green gun
            equippedWeapon = guns[1];
        }

        if (tag == "Blue Gun")
        {
            // Setting up the blue gun
            equippedWeapon = guns[2];
        }

        if (tag == "Purple Gun")
        {
            // Setting up the purple gun
            equippedWeapon = guns[3];
        }

        if (tag == "Orange Gun")
        {
            // Setting up the orange gun
            equippedWeapon = guns[4];
        }

        if (tag == "Red Gun")
        {
            // Setting up the red gun
            equippedWeapon = guns[5];
        }

        // Setting up the script to access to the weapon properties
        mw = equippedWeapon.GetComponent <MyWeapon>();

        // Setting up the fireRate and ammo of the new weapon
        fireRate = mw.fireRate;

        // Setting up the bullet of the new weapon
        bullet = mw.bullet;
        mb     = bullet.GetComponent <MyBullet>();

        // Setting up the speed and strength of new the bullet
        speed = mb.speed;
        // strength = mb.strength;

        // Update Interface
        powerSld.maxValue = mw.ammo;
        powerSld.value    = mw.ammo;
        dw.Display(equippedWeapon);
    }
コード例 #2
0
    public void Display(GameObject weapon)
    {
        mw = weapon.GetComponent <MyWeapon>();
        Color newCol;

        ColorUtility.TryParseHtmlString(mw.color, out newCol);
        sliderImg.color = newCol;

        ammoTxt.color = newCol;

        weaponImg.sprite = mw.sprite;
    }
コード例 #3
0
        public override void Initialize()
        {
            targetHasBeenHit          = false;
            beenHitAnimationIsPlaying = false;
            targetIsDying             = false;
            dyingAnimationIsPlaying   = false;
            hasCompleted = false;

            if (this.targetGameEntity != null)
            {
                // Plot a straight path from the current player to this game entity
                MyWeapon.MyAmmo.MyPath = MyBoard.findPointsAlongLine3D(CurrentPlayer, targetGameEntity, 10f);
                MyWeapon.MyAmmo.setGraphicsMatrices(combatSystem.MyScreen.MyView, combatSystem.MyScreen.MyProjection, combatSystem.MyScreen.MyWorld);
                MyWeapon.fire();
            }
        }
コード例 #4
0
        static void Main(string[] args)
        {
            Enemy enemy = new Enemy("Jimmy the Buff Wizard");

            Console.WriteLine("What is your Name?");
            string PlayerName = Console.ReadLine();

            Console.WriteLine("What weapon will you use?");
            Console.WriteLine("[1]: Axe");
            Console.WriteLine("[2]: Sword");
            string WeaponChoice = Console.ReadLine();
            Weapon MyWeapon;

            if (WeaponChoice == "1")
            {
                MyWeapon = new Axe();
            }
            else
            {
                MyWeapon = new Sword();
            }

            Console.WriteLine("With your new {0} you face your enemy,{1} , but you can tell you will be smacked around unless you get help.", MyWeapon.GetName(), enemy.Name);
            Console.WriteLine("Who will you ask to bless your weapon?");
            Console.WriteLine("[1]: Good God");
            Console.WriteLine("[2]: Evil God");
            Console.WriteLine("[3]: Tom Cruise");
            string UpgradeChoice = Console.ReadLine();

            if (UpgradeChoice == "1")
            {
                MyWeapon = new Good(MyWeapon, PlayerName);
            }
            else if (UpgradeChoice == "2")
            {
                MyWeapon = new Evil(MyWeapon, PlayerName);
            }
            else
            {
                MyWeapon = new TomCruise(MyWeapon, PlayerName);
            }

            Console.WriteLine("With my new {0} I face {1} and defeat him", MyWeapon.GetName(), enemy.Name);
            Console.WriteLine(MyWeapon.WinLine);
            Console.ReadLine();
        }
コード例 #5
0
 protected void CalibrateForBullet()
 {
     SpeedOfBullet = MyWeapon.GetProjectile().GetComponent <FallingBullet>().Speed;
 }
コード例 #6
0
 protected virtual void ActiveWeaponCollider(int iValue)
 {
     MyWeapon.GetComponent <Collider>().enabled = iValue == 0 ? false : true;
 }
コード例 #7
0
//    public Weapon.WeaponEnum CurrentWeapon()
//    {
//        //return MyWeapon.
//    }

    public bool RestrictAnimationRotation()
    {
        return(MyWeapon.RestrictAnimationRotation());
    }