Beispiel #1
0
        protected Spell(Vector3 poolPosition, SpellObject spellObject, UsableServices services)
        {
            Id             = spellObject.Id;
            _speed         = spellObject.Speed;
            _hitRadius     = spellObject.HitRadius;
            SpellColorType = spellObject.SpellColorType;
            _destroyDelay  = spellObject.DestroyAfterTime;
            _poolPos       = poolPosition;
            _services      = services;
            _isSpawnEnemy  = spellObject.MustSpawnOnEnemyPosition;
            _statuses      = new Status[spellObject.StatusObjects.Length];

            if (!_isSpawnEnemy)
            {
                Transform = spellObject.SpawnSpellPosition;
            }

            _projectile = Object.Instantiate(spellObject.Spell);
            _projectile.SetActive(false);
            _projectile.name = $"{Id}";

            int index = 0;

            foreach (StatusObject state in spellObject.StatusObjects)
            {
                _statuses[index] = Invoker.CreateStatus(state);
                index++;
            }
        }
Beispiel #2
0
 public GameSystem(Context context, UsableServices services)
 {
     _systemCollection.Add(new SetupSystem(context, services));
     _systemCollection.Add(new WorldSystem(context, services));
     _systemCollection.Add(new DiceSystem(context, services));
     _systemCollection.Add(new CharacterSystem(context, services));
     _systemCollection.Add(new WeaponSystem(context, services));
     _systemCollection.Add(new StatusSystem(context, services));
     _systemCollection.Add(new InputSystem(context, services));
     _systemCollection.Add(new TurnBaseSystem(context, services));
 }
Beispiel #3
0
        private void Awake()
        {
            _menuContext = MenuContext.GetMenuContext();
            _services    = UsableServices.SharedInstance;
            _services.Initialize(_menuContext);

            _setupSystem = new SetupSystem(_menuContext, _services);
            _menuSystem  = new MenuSystem(_menuContext, _services, log);

            _setupSystem.Awake();
            _menuSystem.Awake();
        }
Beispiel #4
0
        public Bullet(GameObject bulletObject, Vector3 startPosition, float speed, UsableServices services)
        {
            _startPosition = startPosition;
            _speed         = speed;
            _services      = services;
            var direction = PhotonNetwork.IsMasterClient ? 0f : -180f;

            _direction = PhotonNetwork.IsMasterClient ? 1f : -1f;
            _bullet    = Object.Instantiate(bulletObject, _startPosition, Quaternion.Euler(new Vector3(0f, direction, 0f)));

            _rigidbody     = _bullet.GetComponent <Rigidbody>();
            _trailRenderer = _bullet.GetComponent <TrailRenderer>();
        }
Beispiel #5
0
        // private Status[] _statuses;

        public Weapon(WeaponObject weaponObject, UsableServices services)
        {
            _bulletPosition = PhotonNetwork.IsMasterClient ? weaponObject.bulletStartPositionForMasterClient : weaponObject.bulletStartPositionForOtherClient;
            _bullet         = new Bullet(weaponObject.bullet, _bulletPosition, weaponObject.bulletSpeed, services);
            // _damage = weaponObject.damage;
            // _statuses = new Status[weaponObject.statusObjects.Length];

            // var index = 0;
            // foreach (var status in weaponObject.statusObjects)
            // {
            //     _statuses[index] = Invoker.CreateStatus(status);
            //     index++;
            // }
        }
Beispiel #6
0
        private void Awake()
        {
            _context  = GameContext.GetGameContext();
            _services = UsableServices.SharedInstance;
            _services.Initialize(_context);

            _context.Images.AddRange(canvas.GetComponentsInChildren <Image>()
                                     .Where(q => q.GetComponent <HealthBar>() != null));

            PhotonNetwork.AddCallbackTarget(this);

            _gameSystem = new GameSystem(_context, _services);

            _gameSystem.Awake();
        }
Beispiel #7
0
        public Character(CharacterObject characterObject, PositionsObject spawnPositionsObject, UsableServices services, List <GameObject> characters)
        {
            var position = PhotonNetwork.IsMasterClient
                ? spawnPositionsObject.spawnMasterPosition
                : spawnPositionsObject.spawnOtherPosition;
            var rotate = PhotonNetwork.IsMasterClient ? Vector3.forward : Vector3.back;

            _character  = PhotonNetwork.Instantiate($"{Constant.NetworkPrefabsPath}{characterObject.character.name}", position, Quaternion.LookRotation(rotate));
            _animator   = _character.GetComponent <Animator>();
            _photonView = _character.GetPhotonView();

            characters.Add(_character);

            _services = services;
            _state    = new State(characterObject.stateObject);
        }
Beispiel #8
0
 protected System(UsableServices services)
 {
 }
Beispiel #9
0
 public System(Context context, UsableServices services)
 {
     _mainContext = context;
     _services    = services;
 }
Beispiel #10
0
 public CharacterSystem(Context context, UsableServices services) : base(context, services)
 {
     _context = _mainContext as GameContext;
 }
Beispiel #11
0
 public SpellsSpawnController(GameContext context, UsableServices services)
 {
     _context  = context;
     _services = services;
 }
Beispiel #12
0
 public SetupSystem(Context context, UsableServices services) : base(context, services)
 {
 }
Beispiel #13
0
 public TurnBaseSystem(Context context, UsableServices services) : base(context, services)
 {
     _turnCount = 1;
     _context   = _mainContext as GameContext;
 }
Beispiel #14
0
 public NetworkSystem(MenuContext context, UsableServices services, Text log) : base(services)
 {
     _context = context;
     _log     = log;
 }
Beispiel #15
0
 public StatusSystem(Context context, UsableServices services) : base(context, services)
 {
     _context = _mainContext as GameContext;
 }
Beispiel #16
0
 public MenuSystem(MenuContext context, UsableServices services, Text log)
 {
     _context = context;
     // _systemCollection.Add(new NetworkSystem(context, services, log));
     _networkSystem = new NetworkSystem(context, services, log);
 }
Beispiel #17
0
        public static Func <ISpell> CreateSpell(Vector3 poolPosition, SpellObject spellObject, UsableServices services)
        {
            Func <ISpell> result = null;

            switch (spellObject.SpellType)
            {
            case SpellType.None:
                break;

            case SpellType.Meteor:
                result = () => new SpellMeteor(poolPosition, spellObject, services);
                break;

            case SpellType.Golem:
                result = () => new SpellGolem(poolPosition, spellObject, services);
                break;

            case SpellType.Shake:
                result = () => new SpellShake(poolPosition, spellObject, services);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(result);
        }