Exemplo n.º 1
0
    public void BeHeal(float hp)
    {
        if (!isDead)
        {
            BattleFactory.CreateHUDHealText(gameObject, hp);

            unit.currentHp = Mathf.Min(unit.currentHp + hp, unit.complexBattleParam.hp);
        }
    }
Exemplo n.º 2
0
    private void CreateBattle()
    {
        var id = BattleFactory.CreateBattle(battleWorldId: 1);

        battle = BattleFactory.GetBattle(id);
        var input = new BattleInput(battle);

        battle.Input = input;
    }
Exemplo n.º 3
0
        // コンストラクタ --------------------------------

        public BattleGlobal()
        {
            objectsUpdater    = new BalleObjectsUpdater();
            enemyZakoGroup    = new BattleZakoGroup();
            playerZakoGroup   = new BattleZakoGroup();
            collisionMediater = new BattleCollisionMediater();
            factory           = new BattleFactory();
            champions         = new BattleChampionsModel();
            waveModel         = new BattleWaveModel();
        }
Exemplo n.º 4
0
    void Start()
    {
        BattleFactory.AddUnitToLayer(gameObject, layer);

        lifeCycleSec = ParticleHelper.GetlifeCycleSec(transform);
        if (lifeCycleSec < 0)
        {
            isLoop = true;
        }
    }
Exemplo n.º 5
0
 protected void CalcDamage()
 {
     if (!_shoot.isMiss)
     {
         new BulletDamage(_shoot, transform.position);
     }
     else
     {
         BattleFactory.CreateHUDMissText(_shoot.target.gameObject);
     }
 }
Exemplo n.º 6
0
    // Use this for initialization
    void Start()
    {
        BattleFactory.AddUnitToLayer(gameObject, layer);

        _skeleton = GetComponentInChildren <SkeletonAnimation>();
        if (_skeleton != null)
        {
            _skeleton.state.TimeScale = speed;
            _animation = _skeleton.Skeleton.Data.FindAnimation(_skeleton.AnimationName);
            _palyTime  = _animation.Duration;
        }
    }
Exemplo n.º 7
0
    void Start()
    {
        BattleFactory.AddUnitToLayer(gameObject, layer);

        _animation = GetComponentInChildren <Animation> ();
        if (_animation != null)
        {
            _animation [animName].speed = speed;
            _palyTime = _animation [animName].length / speed;
            _animation.Play(animName);
        }
    }
Exemplo n.º 8
0
    // Use this for initialization
    virtual protected void Start()
    {
        BattleFactory.AddUnitToLayer(gameObject, BattleConfig.LAYER.BULLET);


//		float time = Mathf.Sqrt (HEIGHT * 2 / G);
        float time = HEIGHT / Mathf.Abs(speed);

        inertiaSpeed = INERTIA_OFFSET / time;

        transform.Translate(-INERTIA_OFFSET, 0, 0);
    }
Exemplo n.º 9
0
    private void Shoot()
    {
        ShootParam shoot = new ShootParam();

        shoot.attacker       = _unit;
        shoot.target         = currentTarget.target;
        shoot.isMiss         = IsMiss();
        shoot.isDoubleDamage = IsDoubleDamage();
        shoot.damage         = CalcDamage(shoot.isDoubleDamage);
        BattleFactory.CreateBattleBullet(_unit.unit.dataUnit.bulletType, shoot);

        _unit.ToFire();
    }
Exemplo n.º 10
0
        static void Main(string[] args)
        {
            // Declare the dependencies. Usually part of this would be done by DI.
            var factory = new BattleFactory();
            var game    = new GameController(factory);
            var canvas  = new BattleConsoleCanvas();

            // Loop while application is open.
            while (true)
            {
                // Draw the header etc
                DrawTitle();
                Console.ForegroundColor = ConsoleColor.White;
                Console.WriteLine();
                Console.WriteLine("Press any key to start a new game.");
                Console.ReadKey();
                string message  = "Find and destroy the 3 ships - good luck!";
                bool   gameOver = false;

                // Create the and resources.
                game.CreateGame();
                game.AddShip(5);
                game.AddShip(4);
                game.AddShip(4);

                while (!gameOver)
                {
                    Console.Clear();
                    DrawTitle();

                    Console.WriteLine();
                    Console.ForegroundColor = ConsoleColor.Green;
                    Console.WriteLine(message);
                    Console.ForegroundColor = ConsoleColor.White;
                    Console.WriteLine();

                    canvas.Draw(game);
                    Console.WriteLine();
                    Console.WriteLine("Enter coords (e.g. A3):");
                    var coord  = Console.ReadLine();
                    var result = game.EnterCoords(coord);
                    message = result.Message;

                    if (result.GameOver)
                    {
                        gameOver = true;
                        Console.ReadKey();
                    }
                }
            }
        }
Exemplo n.º 11
0
        private void BattleForm_Load(object sender, EventArgs e)
        {
            _battleController = BattleFactory.CreateBattle(
                _playerParty.GetFirstAlivePokemon(),
                _enemyParty.GetFirstAlivePokemon(),
                this,
                _battleLogController);

            SetAttackButtons(_battleController.PlayerPokemon);

            this.Show();
            RedrawUI();
            _battleLogController.SetText($"Wild {_battleController.EnemyPokemon.Name} appears!");
        }
Exemplo n.º 12
0
    public void UpdateInit()
    {
        GameObject[][] tanks = BattleFactory.CreateBattleUnits(InstancePlayer.instance.battle,
                                                               InstancePlayer.instance.battle.dataMap);
        _unitGroup.AddUnit(tanks);

        BattleFactory.CreateBackground(InstancePlayer.instance.battle.mission.asset);



        _gameEntering.Start();

        SwitchState(STATE.ENTERING);
    }
Exemplo n.º 13
0
            public void Init()
            {
                Listeners = new List <IBattleListener>();

                BattleFactory = new BattleFactory();

                // create GameObject as container for battle objects
                Transform containerTr = transform.FindChild("Container");

                if (containerTr != null)
                {
                    Destroy(containerTr.gameObject);
                }

                GameObject containerGo = new GameObject("Container");

                containerGo.transform.parent = transform;
                characterContainer           = containerGo.transform;

                // prepare list for characters
                Characters = new List <lr.obj.CharacterVisual> ();

                Towers = new List <lr.obj.Tower> (2);

                // set player tower
                GameObject towerPlayerGo = GameObject.FindGameObjectWithTag(lr.obj.Tag.TowerPlayer);

                core.Dbg.Assert(towerPlayerGo != null, "BattleInit.Init() - no TowerPlayer found");

                Towers.Add(towerPlayerGo.GetComponent <lr.obj.Tower> ());


                // set enemy tower
                GameObject towerEnemyGo = GameObject.FindGameObjectWithTag(lr.obj.Tag.TowerEnemy);

                core.Dbg.Assert(towerEnemyGo != null, "BattleInit.Init() - no TowerEnemy found");

                Towers.Add(towerEnemyGo.GetComponent <lr.obj.Tower> ());


                Ai = GameObject.FindGameObjectWithTag("AI").GetComponent <AI> ();

                GameObject enemyGo = GameObject.FindGameObjectWithTag("Enemy");

                data.Player enemy = enemyGo.GetComponent <data.Player> ();
                enemy.Init();
                Ai.Init(enemy);
            }
Exemplo n.º 14
0
    public void BeHurt(UnitFire.ShootParam shootParam)
    {
        if (!isDead)
        {
            BattleFactory.CreateHUDDamageText(shootParam);

            unit.currentHp = Mathf.Max(unit.currentHp - shootParam.damage, 0);

            if (unit.currentHp <= 0)
            {
                ToDead();
            }

            _targetSelect.BeHurt(shootParam);
        }
    }
Exemplo n.º 15
0
    protected void CreateEffect()
    {
        GameObject profab = !_shoot.isMiss ? explodeProfab: explodeMissProfab;

        if (profab == null)
        {
            profab = explodeProfab;
        }

        if (profab != null)
        {
//			GameObject effectObj = ResourceHelper.Load(AppConfig.FOLDER_PROFAB_ANIMATION + "testExplode/testExplode");
            GameObject effectObj = Instantiate(profab) as GameObject;
            BattleFactory.AddUnitToLayer(effectObj, BattleConfig.LAYER.EFFECT);
//			RenderHelper.ChangeWholeModelColor (effectObj, Color.green);
            effectObj.transform.position = transform.position;
        }
    }
Exemplo n.º 16
0
        protected override IEnumerable <GameObject> CreateObjs()
        {
            var player = new OrthographicMovingObjectFactory()
                         .CreateMovingObject(Tsx.Create(Path.Combine("Characters", "Gareth.tsx")), _player.Transform.Location, new ZIndex(3))
                         .Add(new TopDownMovement {
                Speed = 0.2f
            });

            PlayerLocation.Current = new PlayerLocation {
                MapName = GetType().Name, Transform = player.World
            };

            yield return(player);

            var cameraPosition = Transform2.CameraZero;

            cameraPosition.Center = player.World.Center - new Vector2(800, 450);
            yield return(Entity
                         .Create("Player Camera", cameraPosition)
                         .Add(new Camera())
                         .AttachTo(player));

            foreach (var tile in new OrthographicTileMapFactory().CreateMap(Tmx.Create(Path.Combine("Maps", "FireCave.tmx"))))
            {
                yield return(tile);
            }

            yield return(Entity.Create("Start Battle", new Transform2(new TilePosition(3, 5, 48), new Size2(48 * 3, 10)))
                         .Add(new Collision {
                IsBlocking = false
            })
                         .Add(x => new BoxCollider(x.World))
                         .Add(new StepTrigger())
                         .Add(new OnCollision {
                Action = x => x.IfEquals(player, () => Navigate.To(BattleFactory.Create()))
            }));

            foreach (var mapEvent in MapEventsFactory.Create(Path.Combine("Content", "Maps", "FireCave.events")).InstantiateEvents())
            {
                yield return(mapEvent);
            }
        }
Exemplo n.º 17
0
 public static bool TeammateCountBattle(ref BattleFactory __instance, BattleConfig config, IEnumerable <BattleCreateInfo> __result)
 {
     bBattle = true;
     return(true);
 }
Exemplo n.º 18
0
            public void ReleaseMissile(data.MissileInstance missileInstance, obj.Types.Side side)
            {
                obj.MissileVisual missileVisual = BattleFactory.CreateMissileBattleVisual(missileInstance, new Context(this), side);

                missileVisual.Init();
            }
Exemplo n.º 19
0
            public void ReleaseCharacter(data.CharacterInstance charInstance, obj.Types.Side side)
            {
                obj.CharacterVisual charVisual = BattleFactory.CreateCharacterBattleVisual(charInstance, new Context(this), side);

                charVisual.Init();
            }
Exemplo n.º 20
0
 // Use this for initialization
 void Start()
 {
     BattleFactory.AddUnitToLayer(gameObject, BattleConfig.LAYER.EFFECT);
 }
    IEnumerator createBombs()
    {
        DataSkill dataSkill = _skill.GetDataSkill();
        float     range     = dataSkill.hintRange;

        List <Vector3> offsets = new List <Vector3> ();
        int            n       = COUNT;

        for (int i = 0; i < n; ++i)
        {
            float theta  = RandomHelper.Range01();
            float radius = Mathf.Sqrt(RandomHelper.Range01() * RandomHelper.Range01()) * range;

            float   x = radius * Mathf.Cos(2 * Mathf.PI * theta);
            float   z = radius * Mathf.Sin(2 * Mathf.PI * theta);
            Vector3 v = new Vector3(x, 0, z);

            offsets.Add(v);
        }

        /*
         * Vector3[] dropPositionOffsets = new Vector3[]{
         *
         *      new Vector3 (-range * 0.8f, 0, range * 0.2f),
         *      new Vector3 (-range * 0.8f, 0, -range * 0.2f),
         *      new Vector3 (0, -1000, 0),
         *
         *      new Vector3 (-range * 0.4f, 0, range * 0.4f),
         *      new Vector3 (-range * 0.4f, 0, 0),
         *      new Vector3 (-range * 0.4f, 0, -range * 0.4f),
         *      new Vector3 (0, -1000, 0),
         *
         *      new Vector3 (0, 0, +range * 0.6f),
         *      new Vector3 (0, 0, +range * 0.2f),
         *      new Vector3 (0, 0, -range * 0.2f),
         *      new Vector3 (0, 0, -range * 0.6f),
         *      new Vector3 (0, -1000, 0),
         *
         *      new Vector3 (range * 0.4f, 0, range * 0.4f),
         *      new Vector3 (range * 0.4f, 0, 0),
         *      new Vector3 (range * 0.4f, 0, -range * 0.4f),
         *      new Vector3 (0, -1000, 0),
         *
         *      new Vector3 (range * 0.8f, 0, range * 0.2f),
         *      new Vector3 (range * 0.8f, 0, -range * 0.2f),
         *      new Vector3 (0, -1000, 0),
         *
         * };
         */

        for (int i = 0; i < offsets.Count; i++)
        {
            Vector3 offset = offsets[i];

            GameObject bomoObject = ResourceHelper.Load(AppConfig.FOLDER_PROFAB + "skill/BombAirStrike");
            BattleFactory.AddUnitToLayer(bomoObject, BattleConfig.LAYER.BULLET);

            SkillBombBase bomb = bomoObject.GetComponent <SkillBombBase>();
            bomb.Init(_skill, _targetPosition + offset);

            spawnBombs.Add(bomb);

            yield return(new WaitForSeconds(DROP_INTERVAL));

            /*
             * if(offset.y < 0)
             * {
             *      yield return new WaitForSeconds(DROP_INTERVAL_LONG);
             * }
             * else
             * {
             *      yield return new WaitForSeconds(DROP_INTERVAL_SHORT);
             * }
             */
        }

        _isStart = true;
    }