Beispiel #1
0
        // Changes a characters weapon
        public void ChangeCharactersWeapon(int characterIndex, IWeaponBehaviour weapon)
        {
            if (weapon == null)
                throw new ArgumentNullException("IWeaponBehaviour passed to GameManager.ChangeCharatersWeapon was NULL");

            if (characterIndex < 0 || characterIndex > characters.Count())
                throw new IndexOutOfRangeException();

            characters[characterIndex].Weapon = weapon;
        }
Beispiel #2
0
        public void ChangeFightingBehaviour(IWeaponBehaviour weaponBehaviour)
        {
            if (weaponBehaviour is null)
            {
                throw new ArgumentNullException(nameof(weaponBehaviour));
            }

            Console.WriteLine(GetType().Name + " changed the fighting behaviour!");
            this.weaponBehaviour = weaponBehaviour;
        }
Beispiel #3
0
        public Character CreateInstance(string characterName, IWeaponBehaviour weaponBehaviour)
        {
            if (string.IsNullOrEmpty(characterName))
            {
                throw new ArgumentNullException(nameof(characterName));
            }
            if (ReferenceEquals(null, weaponBehaviour))
            {
                throw new ArgumentNullException(nameof(weaponBehaviour));
            }

            Type typeToCreate = GetTypeToCreate(characterName);

            if (typeToCreate == null)
            {
                return(new UnknownCharacter(new UnknownBehaviour()));
            }

            return(Activator.CreateInstance(typeToCreate, weaponBehaviour) as Character);
        }
Beispiel #4
0
        private void Downgrade()
        {
            var previousType = m_behaviour.Type;

            switch (previousType)
            {
            case WeaponType.Bomb:
                m_behaviour = WeaponFactory.GetCurrentWeapon(WeaponType.Laser);
                break;

            case WeaponType.Cross:
                m_behaviour = WeaponFactory.GetCurrentWeapon(WeaponType.Bomb);
                break;

            default:
                break;
            }

            TryUpdateWeapon(previousType);
        }
        public static IWeaponBehaviour GetCurrentWeapon(WeaponType type)
        {
            IWeaponBehaviour controller = null;

            switch (type)
            {
            case WeaponType.Laser:
                controller = new WeaponLaserBehaviour();
                break;

            case WeaponType.Bomb:
                controller = new WeaponBombBehaviour();
                break;

            case WeaponType.Cross:
                controller = new WeaponCrossBehaviour();
                break;
            }

            return(controller);
        }
Beispiel #6
0
        public void Upgrade()
        {
            SoundManager.PlaySoundEffect("PowerUpCollected");

            var previousType = m_behaviour.Type;

            switch (previousType)
            {
            case WeaponType.Laser:
                m_behaviour = WeaponFactory.GetCurrentWeapon(WeaponType.Bomb);
                break;

            case WeaponType.Bomb:
                m_behaviour = WeaponFactory.GetCurrentWeapon(WeaponType.Cross);
                break;

            default:
                break;
            }

            TryUpdateWeapon(previousType);
        }
Beispiel #7
0
 void Start()
 {
     m_behaviour     = WeaponFactory.GetCurrentWeapon(WeaponType.Laser);
     m_downgradeTime = Time.time;
 }
Beispiel #8
0
 public SmurfStorm(IWeaponBehaviour weaponBehaviour) : base(weaponBehaviour)
 {
 }
 public Character()
 {
     Weapon = new AxeBehaviour();//wordt nooit gebruikt
 }
Beispiel #10
0
 public abstract void ChangeWeapon(IWeaponBehaviour w);
Beispiel #11
0
 public override void ChangeWeapon(IWeaponBehaviour w)
 {
     weapon = w;
 }
Beispiel #12
0
 protected Person(IWeaponBehaviour weaponBehaviour) => _weaponBehaviour = weaponBehaviour;
Beispiel #13
0
 public abstract void ChangeWeapon(IWeaponBehaviour w);
 // Public interface.
 public void Start()
 {
     _input = GetComponent<PlayerInput>();
     _current_weapon_behaviour = new IdleWeaponBehaivour();
     _animator = GetComponent<Animator>();
 }
Beispiel #15
0
 public Smurfette(IWeaponBehaviour iwb) : base(iwb)
 {
 }
Beispiel #16
0
 public SmurfStorm(IWeaponBehaviour iwb) : base(iwb)
 {
 }
Beispiel #17
0
 public King(IWeaponBehaviour iwb) : base(iwb)
 {
 }
 public Knight(IWeaponBehaviour iwb) : base(iwb)
 {
 }
Beispiel #19
0
 public Mindil(IWeaponBehaviour iwb) : base(iwb)
 {
 }
Beispiel #20
0
 public UnknownCharacter(IWeaponBehaviour weaponBehaviour) : base(weaponBehaviour)
 {
 }
Beispiel #21
0
 public Bowman(IWeaponBehaviour weaponBehaviour) : base(weaponBehaviour)
 {
 }
Beispiel #22
0
 public Troll(IWeaponBehaviour weaponBehaviour) : base(weaponBehaviour)
 {
 }
 public void Update()
 {
     _current_weapon_behaviour = _current_weapon_behaviour.Update(this, _animator);
 }
 public Troll(IWeaponBehaviour iwb) : base(iwb)
 {
 }
Beispiel #25
0
 public Knight(IWeaponBehaviour weaponBehaviour) : base(weaponBehaviour)
 {
 }
Beispiel #26
0
 public Queen(IWeaponBehaviour weaponBehaviour) : base(weaponBehaviour)
 {
 }
Beispiel #27
0
 public Queen(IWeaponBehaviour iwb) : base(iwb)
 {
 }
Beispiel #28
0
 public Character(IWeaponBehaviour weaponBehaviour)
 {
     this.weaponBehaviour = weaponBehaviour;
 }
Beispiel #29
0
 public Smurfette(IWeaponBehaviour weaponBehaviour) : base(weaponBehaviour)
 {
 }
Beispiel #30
0
 public King(IWeaponBehaviour weaponBehaviour) : base(weaponBehaviour)
 {
 }
Beispiel #31
0
 public void setWeapon(IWeaponBehaviour weapon) => this.weapon = weapon;
 public Character()
 {
     Weapon = new KnifeBehaviour(); // as default.
 }
Beispiel #33
0
 public override void ChangeWeapon(IWeaponBehaviour w)
 {
     weapon = w;
 }
Beispiel #34
0
 public Swordsman(IWeaponBehaviour weaponBehaviour) : base(weaponBehaviour)
 {
 }