Beispiel #1
0
    private void OnTriggerEnter(Collider other)
    {
        //if (other.gameObject.tag == "bullet")
        //{


        //    GameObject blood = Instantiate<GameObject>(bloodEffect, enemy.transform.position, enemy.transform.rotation, transform);
        //    print("bullet hit");
        //    recivedDmg = true;
        //    Destroy(other.gameObject);
        //    healthPoints -= 10.0f;
        //}
        //else if (other.gameObject.tag == "melee")
        //{
        //    GameObject blood = Instantiate<GameObject>(bloodEffect, enemy.transform.position, enemy.transform.rotation, transform);
        //    print("melee hit");
        //    recivedDmg = true;
        //    Destroy(other.gameObject);
        //    healthPoints -= 20.0f;
        //}

        if (WeaponsFactory.TagSupported(other.gameObject.tag))
        {
            this.handleWeapon(other.gameObject);
        }

        if (healthPoints <= 0)
        {
            Destroy(this.gameObject);
        }
    }
Beispiel #2
0
        /// <summary>
        /// Creates an instance of the View Controller
        /// </summary>
        /// <param name="view">The View the Controller is relating to</param>
        /// <param name="weapFab">The Weapons Factory the Controller is relating to</param>
        public WeaponViewController(IWeaponsView view, WeaponsFactory weapFab)
        {
            _view    = view;
            _weapFab = weapFab;

            _view.SetController(this);
            this.loadView();
        }
        public void CanRaiseEvent()
        {
            HitzoneFactory testHizonesFab = new HitzoneFactory();
            WeaponsFactory testWeapFab    = new WeaponsFactory();
            CharacterSheet testSheet      = new CharacterSheet(testHizonesFab.getZonesFor(testHizonesFab.AvailableRaces[0]), testWeapFab.getWeapon(testWeapFab.AvailableWeapons[0]));

            testSheet.charHandler += TestChar_changed;

            //Tbd
        }
        public void Run()
        {
            while (true)
            {
                this.input = Console.ReadLine()
                             .Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)
                             .ToArray();

                if (input[0] == "END")
                {
                    break;
                }

                var command = this.input[0];

                switch (command)
                {
                case "Create":
                    var levelType    = string.Join("", input[1].Split().Take(1));
                    var typeOfWeapon = string.Join("", input[1].Split().Skip(1));

                    this.Weapons.Add(WeaponsFactory.CreateNewWeapon(levelType, typeOfWeapon, input[2]));
                    break;

                case "Add":
                    var weaponName    = input[1];
                    var socketIndex   = int.Parse(input[2]);
                    var gemType       = string.Join("", input[3].Split().Skip(1));
                    var gemClarity    = string.Join("", input[3].Split().Take(1));
                    var currentWeapon = this.Weapons.First(x => x.WeaponName == weaponName);
                    var currentGem    = GemsFactory.MakeNewGem(gemClarity, gemType);

                    currentWeapon.AddGem(currentGem, socketIndex);    //, this.magicalStats);
                    break;

                case "Remove":
                    weaponName    = input[1];
                    socketIndex   = int.Parse(input[2]);
                    currentWeapon = this.Weapons.First(x => x.WeaponName == weaponName);

                    currentWeapon.RemoveGem(socketIndex);    //, this.magicalStats);
                    break;

                case "Print":
                    foreach (var weapon in this.Weapons.Where(x => x.WeaponName == input[1]))
                    {
                        Console.Write(weapon);
                        //Console.WriteLine(this.magicalStats);
                        Console.WriteLine();
                    }
                    break;
                }
            }
        }
Beispiel #5
0
    private void handleWeapon(GameObject OtherEntity)
    {
        Weapon weapon = WeaponsFactory.GetByTag(OtherEntity.tag);

        GameObject blood = Instantiate <GameObject>(bloodEffect, enemy.transform.position, enemy.transform.rotation, transform);

        print("bullet hit");
        recivedDmg = true;
        Destroy(OtherEntity.gameObject);
        healthPoints -= weapon.Hitpoints;
    }
        public CARCalculator()
        {
            Log        = CombatLog.getInstance;
            Time       = CombatTime.getInstance;
            HitFab     = new HitzoneFactory();
            WeapFab    = new WeaponsFactory();
            DiceEngine = new DiceInterpreter();

            PlayerCharacter = new CharacterSheet(HitFab.getZonesFor(HitFab.AvailableRaces[0]), WeapFab.getWeapon(WeapFab.AvailableWeapons[0]));
            EnemyCharacter  = new CharacterSheet(HitFab.getZonesFor(HitFab.AvailableRaces[0]), WeapFab.getWeapon(WeapFab.AvailableWeapons[0]));
            Round           = 0;
        }
Beispiel #7
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        string   weaponsJson = Resources.Load("Configs/weapons").ToString();
        JSONNode weaponsNode = JSON.Parse(weaponsJson);

        foreach (string key in weaponsNode.Keys)
        {
            string weaponDesc = weaponsNode[key].ToString();
            Weapon weapon     = JsonUtility.FromJson <Weapon>(weaponDesc);
            weapons.Add(key, weapon);
        }

        weaponIds = new string[weapons.Count];
        weapons.Keys.CopyTo(weaponIds, 0);
    }
Beispiel #8
0
 public void InitWeaponsFactory()
 {
     WeapFab = new WeaponsFactory();
 }