Example #1
0
    void Start()
    {
        matchSetup.Init();

        // scripts
        net      = GetComponent <CcNet>();
        Log      = GetComponent <CcLog>();
        arse     = GetComponent <Arsenal>();
        controls = GetComponent <Controls>();
        locUser  = GetComponent <LocalUser>();

        // make local user
        net.LocEnt          = new NetEntity();
        net.LocEnt.local    = true;
        net.LocEnt.name     = PlayerPrefs.GetString("PlayerName", defaultName);
        net.LocEnt.headType = PlayerPrefs.GetInt("PlayerHead", 0);
        net.LocEnt.colA.r   = PlayerPrefs.GetFloat("PlayerColA_R", Color.yellow.r);
        net.LocEnt.colA.g   = PlayerPrefs.GetFloat("PlayerColA_G", Color.yellow.g);
        net.LocEnt.colA.b   = PlayerPrefs.GetFloat("PlayerColA_B", Color.yellow.b);
        net.LocEnt.colA.a   = 1;
        net.LocEnt.colB.r   = PlayerPrefs.GetFloat("PlayerColB_R", Color.green.r);
        net.LocEnt.colB.g   = PlayerPrefs.GetFloat("PlayerColB_G", Color.green.g);
        net.LocEnt.colB.b   = PlayerPrefs.GetFloat("PlayerColB_B", Color.green.b);
        net.LocEnt.colB.a   = 1;
        net.LocEnt.colC.r   = PlayerPrefs.GetFloat("PlayerColC_R", Color.cyan.r);
        net.LocEnt.colC.g   = PlayerPrefs.GetFloat("PlayerColC_G", Color.cyan.g);
        net.LocEnt.colC.b   = PlayerPrefs.GetFloat("PlayerColC_B", Color.cyan.b);
        net.LocEnt.colC.a   = 1;

        // load settings
        Log.FadeTime     = PlayerPrefs.GetFloat("textFadeTime", 10f);
        net.gunBobbing   = PlayerPrefs.GetInt("GunBobbing", 1) == 1;
        Sfx.VolumeMaster = PlayerPrefs.GetFloat("MasterVolume", 1f);
        S.Hud            = this;
    }
Example #2
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            if (!initialized)
            {
                bossSong        = Game.Content.Load <Song>("Music/vengeance");
                gameSong        = Game.Content.Load <Song>("Music/menumusic");
                menuSong        = Game.Content.Load <Song>("Music/shadowforce");
                this.components = new List <GameComponent>();
                this.player     = new PlayerShip(Game, this);
                this.arsenal    = new Arsenal(Game, this);
                this.components.Add(this.Player);
                this.components.Add(this.arsenal);
                this.newComponents = new List <GameComponent>();
                this.oldComponents = new List <GameComponent>();
                this.lose          = -1;

                this.random  = new Random();
                this.content = Game.Content;

                this.gameSpeed = 10;
                this.ResetSpeedTimer();
                this.ResetBossTimer();
                this.intro = 300;

                shipAnimationStatic = new Animation(this.Game.Content, "Sprites/playerShip", 32, 16, 1, 1);

                foreach (GameComponent component in this.components)
                {
                    component.Initialize();
                }

                initialized = true;
            }
        }
Example #3
0
 public double Damage(Arsenal weapon, Arsenal weaknessMod, int baseStat)
 {
     double damage;
     if (weapon == Arsenal.GreatSword || weapon == Arsenal.Rock)
     {
         damage = Dice.D4() + baseStat;
     }
     else if (weapon == Arsenal.Dagger || weapon == Arsenal.Club)
     {
         damage = Dice.D6() + baseStat;
     }
     else if (weapon == Arsenal.Staff || weapon == Arsenal.Claw)
     {
         damage = Dice.D8() + baseStat;
     }
     else
     {
         Console.WriteLine("This weapon does not exist");
         damage = 0;
     }
     if (weaknessMod == weapon)
     {
         damage = damage * 1.25;
     }
     return damage;
 }
 public void AcquireEquipment(IEquipment equipment)
 {
     if (Arsenal.Count < 5)
     {
         Arsenal.Add(equipment);
     }
 }
Example #5
0
    private void Awake()
    {
        arsenal = GetComponent <Arsenal>();
        arsenal.onWeaponsChanged.AddListener(InitWeaponPos);

        charController = GetComponent <CharController>();
    }
Example #6
0
 void Start()
 {
     print(speed);
     //预设参数
     isAlive    = true;
     deathTimer = deathTime;
     MaxHP      = InitialMaxHP;
     MaxMP      = InitialMaxMP;
     HP         = InitialHP;
     MP         = InitialMP;
     if (MelleTendency == 0)
     {
         MelleTendency = 0.8f;
     }
     if (fireAgility == 0)
     {
         fireAgility = 1f;
     }
     status = 0;
     //寻找:场景物品
     itemList = GameObject.Find("ItemList").transform;
     //寻找:武器控制
     arsenal = GetComponentInChildren <Arsenal>();
     //寻找:捡拾控制
     pickArea        = GetComponentInChildren <CircleCollider2D>();
     pickArea.radius = itemPickUpRange;
     //寻找:渲染器
     sr = GetComponentInChildren <SpriteRenderer>();
 }
Example #7
0
        public static double Damage(Arsenal weapon, Arsenal weaknessMod, int attackMod, out int attackDice)
        {
            double damage;

            if (weapon == Arsenal.GreatSword || weapon == Arsenal.Rock)
            {
                attackDice = Dice.D4();
                damage     = attackDice + attackMod;
            }
            else if (weapon == Arsenal.Dagger || weapon == Arsenal.Club)
            {
                attackDice = Dice.D6();
                damage     = attackDice + attackMod;
            }
            else if (weapon == Arsenal.Staff || weapon == Arsenal.Claw)
            {
                attackDice = Dice.D8();
                damage     = attackDice + attackMod;
            }
            else
            {
                Console.WriteLine("This weapon does not exist");
                damage     = 0;
                attackDice = 0;
            }
            if (weaknessMod == weapon)
            {
                damage = Math.Round(damage * 1.25);
            }
            return(damage);
        }
        public void AddArsenal(Arsenal arsenal)
        {
            var equip = new EquipArsenal(_warior);

            switch ((int)arsenal)
            {
            case 0:
                equip.UnEquip();
                break;

            case 1:
                equip.EquipDanger();
                break;

            case 2:
                equip.EquipBow();
                break;

            case 3:
                equip.EquipMace();
                break;

            case 4:
                equip.EquipSword();
                break;

            case 5:
                equip.EquipAx();
                break;
            }
        }
Example #9
0
    void Start()
    {
        GameObject gameControllerObject = GameObject.FindGameObjectWithTag("GameController");

        arsenal = gameControllerObject.GetComponent <Arsenal>();

        playerShip = GameObject.FindGameObjectWithTag("Player");

        fireRate = arsenal.GetFireRate(fireType);

        switch (typeIAAction)
        {
        case 1:
            //nothing
            break;

        case 2:
            StartCoroutine(SimulatorAction());
            break;

        default:
            StartCoroutine(simpleAction());
            break;
        }
    }
Example #10
0
    void Start()
    {
        // Get reference to arsenal script
        _arsenal    = GetComponent <Arsenal>();
        _currentGun = _arsenal.currentGun;

        // Subscribe to arsenal's gun-switch event
        _arsenal.OnSwitchGun += OnSwitchGun;
    }
Example #11
0
    void Awake()
    {
        characteristics = GetComponent <Characteristics>();
        manaMgr         = GetComponent <ManaManager>();
        arsenal         = GetComponent <Arsenal>();
        damageable      = GetComponent <Damageable>();
        lvlMng          = GetComponent <LevelManager>();

        characteristics.onStatsChanged.AddListener(UpdateHealthStats);
    }
Example #12
0
        public virtual void Use()
        {
            Ammo ammo = Arsenal.FirstOrDefault(a => a.IsDraw == false);

            if (ammo != null)
            {
                ammo.IsDraw     = true;
                ammo.Velocity.X = GameSettings.GetInstance().AmmoSpeed;
            }
        }
Example #13
0
    private void Start()
    {
        inputSystem = GetComponent <InputSystem>();
        inputSystem.onSpellCast.AddListener(OnSpellCast);
        inputSystem.onSpellCastUp.AddListener(() => { animator.SetBool("SpellCast", false); });

        arsenal        = GetComponent <Arsenal>();
        charController = GetComponent <CharController>();
        animator       = GetComponent <Animator>();
        manaManager    = GetComponent <ManaManager>();
    }
Example #14
0
 public Character(string characterName, int hitPoints, int strength, int dex, int intelligence, int armor, Arsenal weaknessMod, bool IsAlive, bool IsPlayer)
 {
     CharacterName = characterName;
     HitPoints     = hitPoints;
     Strength      = strength;
     Dex           = dex;
     Intelligence  = intelligence;
     Armor         = armor;
     WeaknessMod   = weaknessMod;
     IsAlive       = true;
     IsPlayer      = false;
 }
Example #15
0
 public void EquiparArma(Arsenal arma)
 {
     if (arma._TipoCategoria.Equals(0))
     {
         _ArmaID_MDireita = arma.ID;
     }
     else
     {
         _ArmaID_MDireita  = arma.ID;
         _ArmaID_MEsquerda = arma.ID;
     }
 }
Example #16
0
    public void lootArsenal()
    {
        if (arsenalsLootable.Count > 0)
        {
            string boost = arsenalsLootable[UnityEngine.Random.Range(0, arsenalsLootable.Count)];

            Arsenal a = arsenals.Find(arsenal => arsenal.myName == boost);

            if (a == null)
            {
                Debug.LogWarning("Could not find arsenal : " + boost);
                return;
            }

            switch (a.myName)
            {
            case "Damage":
                a.totalEffect += a.effect;
                if (a.totalEffect > 2)
                {
                    a.totalEffect = 2;
                    arsenalsLootable.Remove(boost);
                }
                ApplyArsenalToGear();
                break;

            case "RechargeTime":
                a.totalEffect -= a.effect;
                if (a.totalEffect < 0.5f)
                {
                    a.totalEffect = 0.5f;
                    arsenalsLootable.Remove(boost);
                }
                ApplyArsenalToGear();
                break;

            case "FireRate":
                a.totalEffect += a.effect;
                if (a.totalEffect > 2)
                {
                    a.totalEffect = 2;
                    arsenalsLootable.Remove(boost);
                }
                ApplyArsenalToGear();
                break;

            default:
                Debug.LogWarning("Error for arsenal : " + boost);;
                break;
            }
        }
    }
Example #17
0
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         _instance          = this;
         craftableItemCount = 0;
         InitializeTables();
     }
 }
Example #18
0
 public Character(string characterName, double hitPoints, int strength, int dex, int intelligence, int armor, Arsenal weaknessMod, bool isAlive, bool isPlayer, int attackMod)
 {
     CharacterName = characterName;
     HitPoints     = hitPoints;
     Strength      = strength;
     Dex           = dex;
     Intelligence  = intelligence;
     Armor         = armor;
     WeaknessMod   = weaknessMod;
     IsAlive       = isAlive;
     IsPlayer      = isPlayer;
     AttackMod     = attackMod;
 }
Example #19
0
    public void InitializeArsenals()
    {
        Arsenal damage       = new Arsenal("Damage", playerController, 0.1f, 1f);
        Arsenal rechargeTime = new Arsenal("RechargeTime", playerController, 0.1f, 1f);
        Arsenal fireRate     = new Arsenal("FireRate", playerController, 0.1f, 1f);

        slotsController.arsenals.Add(damage);
        slotsController.arsenals.Add(rechargeTime);
        slotsController.arsenals.Add(fireRate);
        foreach (Arsenal a in slotsController.arsenals)
        {
            slotsController.arsenalsLootable.Add(a.myName);
        }
    }
        private void RunArsenal()
        {
            Arsenal arsenal = new Arsenal();
             arsenal["bomb"] = new Weapon(WeaponCategory.Explosive, 300) {Name = "IED", Power = 45};
             arsenal["m16"] = new Weapon(WeaponCategory.Shoot, 100) {Name = "M16", Power = 55};
             arsenal["sword"] = new Weapon(WeaponCategory.Slice, 8000) {Name = "Katana", Power = 95};
             arsenal["bomb"] = new Weapon( WeaponCategory.Specialized, 900 ) { Name = "NuclearMissle", Power = 100 };

             foreach( KeyValuePair<string, Weapon> item in arsenal )
             {
            Console.WriteLine( item.Key );
            item.Value.Display();
             }
        }
    void Start()
    {
        GameObject gameControllerObject = GameObject.FindGameObjectWithTag("GameController");
        arsenal = gameControllerObject.GetComponent<Arsenal>();
        uiController = gameControllerObject.GetComponent<UIController>();
        GameObject dataControllerObject = GameObject.FindGameObjectWithTag("DataController");
        dataController = dataControllerObject.GetComponent<DataController> ();

        playerController = GetComponent<PlayerController>();

        fireRate = arsenal.GetFireRate (fireType);
        fireBombRate = arsenal.GetFireRate (Constants.BOMB);

        numberOfSpawn = shotSpawnLeft.Length - 1;
    }
Example #22
0
 public void ChooseWeapon()
 {
     foreach (var player in Players)
     {
         Console.WriteLine("\nOk.{0} choose your weapon from list.. ", player.Name);
         Console.WriteLine("Id : Name");
         foreach (var weapon in Arsenal)
         {
             Console.WriteLine("{0}  : {1}", weapon.Id, weapon.Name);
         }
         Console.WriteLine("Enter Id..");
         var chosenItem = Int32.Parse(Console.ReadLine());
         player.EquipItem(Arsenal.Where(o => o.Id == chosenItem).FirstOrDefault());
     }
 }
Example #23
0
 public ShotGun(Sprite owner, Sprite oppenent, Sprite ball)
 {
     this.Name   = "ShotGun";
     Owner       = owner;
     Oppenent    = oppenent;
     Ball        = ball;
     Size.Width  = 4 * Brick.Width;
     Location.X  = Owner.Location.X + Owner.Size.Width + Brick.Width;
     Location.Y  = Owner.Location.Y + Owner.Size.Height / 2;
     Size.Height = Brick.Height;
     for (int i = 0; i < GameSettings.GetInstance().DefaultAmmo; i++)
     {
         Arsenal.Add(new Bullet(this));
     }
     this.Drawer = new ShotGunDrawer(this);
 }
        public void Injure()
        {
            if (Wounds < 2)
            {
                Wounds++;
            }

            if (Arsenal.Count <= 0)
            {
                return;
            }

            var lastEquipment = Arsenal.Count - 1;

            Arsenal.RemoveAt(lastEquipment);
        }
    void Start()
    {
        GameObject gameControllerObject = GameObject.FindGameObjectWithTag("GameController");

        arsenal      = gameControllerObject.GetComponent <Arsenal>();
        uiController = gameControllerObject.GetComponent <UIController>();
        GameObject dataControllerObject = GameObject.FindGameObjectWithTag("DataController");

        dataController = dataControllerObject.GetComponent <DataController> ();

        playerController = GetComponent <PlayerController>();

        fireRate     = arsenal.GetFireRate(fireType);
        fireBombRate = arsenal.GetFireRate(Constants.BOMB);

        numberOfSpawn = shotSpawnLeft.Length - 1;
    }
Example #26
0
        public Unit(int id, IUnitObject unitObject, Faction startingFaction)
        {
            Id         = id;
            UnitObject = unitObject;

            var provider = ManagerProvider.Instance;

            Player           = provider.PlayerManager.GetPlayer(startingFaction);
            CommandProcessor = new CommandProcessor(provider.CommandManager.CommandFactory, provider.TimeManager, provider.GameSettings.UnitCommandsUpdatePeriod, this);
            Partset          = new Partset();
            Navigation       = new Navigation(UnitObject);
            Following        = new Following(Navigation, provider.TimeManager);
            Targeting        = new UnitTargeting(Player.Faction);
            Arsenal          = new Arsenal(Id, Navigation, Targeting, Following, Partset, provider.ShotsManager, provider.TimeManager);
            Selectable       = new Selectable();
            Visibility       = new Visibility(Player.Faction);
            Hull             = new Hull();
            Hull.OnDeath    += Die;
        }
Example #27
0
    static void CreateFont()
    {
        Arsenal arsenal = ScriptableObject.CreateInstance <Arsenal>();

        string path = AssetDatabase.GetAssetPath(Selection.activeObject);

        if (path == "")
        {
        }
        else if (Path.GetExtension(path) != "")
        {
            path = path.Replace(Path.GetFileName(AssetDatabase.GetAssetPath(Selection.activeObject)), "");
        }

        string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath(path + "/New Arsenal.asset");

        AssetDatabase.CreateAsset(arsenal, assetPathAndName);
        AssetDatabase.SaveAssets();
        EditorUtility.FocusProjectWindow();
        Selection.activeObject = arsenal;
    }
Example #28
0
        private void TouchTracker()
        {
            Touch touch;

            if (Input.touchCount < 1 || (touch = Input.GetTouch(0)).phase != TouchPhase.Began)
            {
                return;
            }
            Vector3 t = (Vector3)touch.position + Vector3.forward * 3;
            Vector3 f = m_firstPersonCamera.ScreenToWorldPoint(t);//.ScreenPointToRay(touch.position).direction;

            Arsenal.fire(POVShip.main.gameObject, 0, POVShip.location() + f * 0.06f, f);

            /*TrackableHit hit;
             * TrackableHitFlag raycastFilter = TrackableHitFlag.PlaneWithinBounds | TrackableHitFlag.PlaneWithinPolygon;
             *
             * if (Session.Raycast(m_firstPersonCamera.ScreenPointToRay(touch.position), raycastFilter, out hit))
             * {
             *  // Create an anchor to allow ARCore to track the hitpoint as understanding of the physical
             *  // world evolves.
             *  var anchor = Session.CreateAnchor(hit.Point, Quaternion.identity);
             * }*/
        }
Example #29
0
 public Warrior(string characterName, double hitPoints, int strength, int dex, int intelligence, int armor, Arsenal weapon, Arsenal weaknessMod, bool IsAlive, bool IsPlayer, int attackMod)
     : base(characterName, hitPoints, strength, dex, intelligence, armor, weaknessMod, IsAlive, IsPlayer, attackMod)
 {
     this.Job      = "Warrior";
     this.Weapon   = weapon;
     this.IsPlayer = true;
 }
Example #30
0
 // Use this for initialization
 void Start()
 {
     createBullet = GetComponent <CreateBulletFunc> ();
     arsenal      = transform.parent.gameObject.GetComponent <Arsenal> ();
 }
Example #31
0
 public Troll(string characterName, double hitPoints, int strength, int dex, int intelligence, int armor, Arsenal weapon, Arsenal weaknessMod, bool IsAlive, bool IsPlayer, int attackMod)
     : base(characterName, hitPoints, strength, dex, intelligence, armor, weaknessMod, IsAlive, IsPlayer, attackMod)
 {
     this.Job         = "Troll";
     this.Weapon      = weapon;
     this.WeaknessMod = Arsenal.GreatSword;
 }
Example #32
0
        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            if (!initialized)
            {
                this.keyboard = new GameKeyboard();
                bossSong = game.Content.Load<Song>("Music/vengeance");
                gameSong = game.Content.Load<Song>("Music/menumusic");
                menuSong = game.Content.Load<Song>("Music/shadowforce");
                this.components = new List<GameComponent>();
                this.player = new PlayerShip(game, this);
                this.arsenal = new Arsenal(game, this);
                this.components.Add(this.Player);
                this.components.Add(this.arsenal);
                this.newComponents = new List<GameComponent>();
                this.oldComponents = new List<GameComponent>();
                this.lose = -1;

                this.random = new Random();
                this.content = game.Content;

                this.gameSpeed = 10;
                this.ResetSpeedTimer();
                this.ResetBossTimer();
                this.intro = 300;

                shipAnimationStatic = new Animation(this.Game.Content, "Sprites/playerShip", 32, 16, 1, 1);

                foreach (GameComponent component in this.components)
                {
                    component.Initialize();
                }

                initialized = true;
            }
        }
Example #33
0
 /// <summary>
 /// Updates gun currently in use when the gun is switched in the arsenal
 /// </summary>
 private void OnSwitchGun(Arsenal sender)
 {
     _currentGun = sender.currentGun;
 }
    void Start()
    {
        GameObject gameControllerObject = GameObject.FindGameObjectWithTag("GameController");
        arsenal = gameControllerObject.GetComponent<Arsenal>();

        playerShip = GameObject.FindGameObjectWithTag ("Player");

        fireRate = arsenal.GetFireRate (fireType);

        switch (typeIAAction) {
        case 1:
            //nothing
            break;
        case 2:
            StartCoroutine(SimulatorAction());
            break;
        default:
            StartCoroutine(simpleAction());
            break;
        }
    }