Ejemplo n.º 1
0
 // Use this for initialization
 public virtual void Start()
 {
     currentHealth = health;
     baseBomb      = null;
     isExploded    = false;
     passedTime    = 0;
 }
Ejemplo n.º 2
0
        protected virtual void RemoveBomb(BaseBomb bomb)
        {
            if (BaseCurrentMap.Board[bomb.CellPosition.X, bomb.CellPosition.Y] is BaseBomb)
            {
                BaseCurrentMap.Board[bomb.CellPosition.X, bomb.CellPosition.Y] = null;
            }

            BaseCurrentMap.CollisionLayer[bomb.CellPosition.X, bomb.CellPosition.Y] = false;

            // Update the hazard map
            List <BaseBomb> bL = _baseBombList.FindAll(b => !b.InDestruction);

            foreach (Point p in bomb.ActionField)
            {
                bool sameCellThanAnOther = false;
                if (_baseBombList.Where(
                        b => !(b.CellPosition.X == bomb.CellPosition.X &&
                               b.CellPosition.Y == bomb.CellPosition.Y)).Any(
                        b => b.ActionField.Find(c => c.X == p.X && c.Y == p.Y) != Point.Zero))
                {
                    HazardMap[p.X, p.Y] = 2;
                    sameCellThanAnOther = true;
                }
                if (!sameCellThanAnOther)
                {
                    HazardMap[p.X, p.Y] = 0;
                }
            }

            _baseBombList.Remove(bomb);
        }
Ejemplo n.º 3
0
        protected virtual void AddBomb(BaseBomb bomb)
        {
            BaseCurrentMap.Board[bomb.CellPosition.X, bomb.CellPosition.Y]          = bomb;
            BaseCurrentMap.CollisionLayer[bomb.CellPosition.X, bomb.CellPosition.Y] = true;

            _baseBombList.Add(bomb);
        }
Ejemplo n.º 4
0
 public void Spawn(BaseUnit unit, BaseTile baseTile)
 {
     if (CanSpawnBomb())
     {
         BaseBomb bombInst = Instantiate(bomb, baseTile.transform.position, Quaternion.identity);
         InitBomb(ref bombInst, baseTile);
         bombInst.OnBombExploded += DecreasBombAmountAferExplosion;
         IncreaseBombAmountAfterSpawn();
     }
 }
Ejemplo n.º 5
0
 public void DeleteBomb(BaseBomb logic, bool test_)
 {
     if (m_dicBombView.ContainsKey(logic.ID))
     {
         if (m_dicBombView[logic.ID] != null)
         {
             GameObject.Destroy(m_dicBombView[logic.ID].gameObject);
         }
         m_dicBombView.Remove(logic.ID);
     }
 }
Ejemplo n.º 6
0
        public void SetBombLogic(BaseBomb logic)
        {
            m_stBombLogic = logic;
            GameObject pfb    = Resources.Load("Spine/ZD" + logic.Config.m_iResourceID) as GameObject;
            GameObject aniObj = Instantiate <GameObject>(pfb);

            aniObj.transform.parent     = this.transform;
            aniObj.transform.position   = this.transform.position;
            m_stAnimation               = aniObj.GetComponent <SkeletonAnimation>();
            m_stAnimation.AnimationName = SkillManager.cur_fly;
            m_stAnimation.loop          = true;
            m_eState = BombState.FLY;
        }
Ejemplo n.º 7
0
        public void AddBomb(BaseBomb logic, bool is_foucs)
        {
            GameObject bombView = GameGOW.Get().ResourceMgr.GetRes("Prefab/BaseBomb");

            bombView.transform.position = new Vector3(logic.Position.x, logic.Position.y, 5);
            BombView view = bombView.GetComponent <BombView>();

            view.SetBombLogic(logic);
            view.transform.parent   = m_pZSort;
            m_dicBombView[logic.ID] = view;

            if (is_foucs)
            {
                m_pCamera.SetFocus(bombView.transform);
            }
        }
Ejemplo n.º 8
0
    void CmdSpawnBomb()
    {
        if (AttackPoint < AttackCost)
        {
            return;
        }
        //Debug.Log("Attack");
        CurrentAnim.SetBool("Walking", false);

        Spawend_Bomb = (GameObject)Instantiate(ref_BombPrefeb, transform);

        BombClass = Spawend_Bomb.GetComponent <BaseBomb>();
        BombClass.SetTypeOfBomb(TypeofBomb);
        BombClass.PlaneDirection = Direction;
        NetworkServer.Spawn(BombClass.gameObject);
        AttackPoint = AttackPoint - AttackCost;
    }
Ejemplo n.º 9
0
        protected virtual void DestroyBomb(BaseBomb baseBomb)
        {
            if (baseBomb != null)
            {
                // We don't forget to give it back to its owner
                if (baseBomb.PlayerId >= 0)
                {
                    BasePlayer player = _basePlayerList.Find(p => p.Id == baseBomb.PlayerId);

                    if (player != null && player.CurrentBombAmount < player.TotalBombAmount)
                    {
                        player.CurrentBombAmount++;
                    }
                }

                baseBomb.Destroy();
            }
        }
Ejemplo n.º 10
0
    public virtual void setBombData(BombInfo bombInfo)
    {
        type         = bombInfo.type;
        initPosition = bombInfo.initPosition.GetV3();
        initAngle    = bombInfo.initAngle;
        isLocked     = bombInfo.isLocked;
        timeout      = bombInfo.timeout;

        switch (type)
        {
        case Constants.BombTypes.normal:
            baseBomb = new BaseNormalBomb();
            break;

        case Constants.BombTypes.shooter:
            baseBomb = new BaseShooterBomb();
            break;

        case Constants.BombTypes.target:
            baseBomb = new BaseTargetBomb();
            break;

        case Constants.BombTypes.wave:
            baseBomb = new BaseWaveBomb();
            break;

        case Constants.BombTypes.acid:
            baseBomb = new BaseAcidBomb();
            break;
        }
        radius        = baseBomb.radius;
        speed         = baseBomb.speed;
        numPoints     = baseBomb.numPoints;
        bulletDamage  = baseBomb.bulletDamage;
        bulletHealth  = baseBomb.bulletHealth;
        health        = baseBomb.health;
        currentHealth = baseBomb.currentHealth;
        valueInCoin   = baseBomb.valueInCoin;

        intervalCounter = 0;

        if (isLocked)
        {
            locked.SetActive(true);
        }
        else
        {
            locked.SetActive(false);
        }

        if (timeout > 0)
        {
            timer.gameObject.SetActive(true);
        }
        else
        {
            timer.gameObject.SetActive(false);
        }

        if (bombInfo.movement == null || bombInfo.movement.speed <= 0)
        {
            GetComponent <BombMovement>().enabled = false;
        }
        else
        {
            GetComponent <BombMovement>().enabled = true;
            GetComponent <BombMovement>().SetMovementData(bombInfo.movement);
        }

        if (bombInfo.rotate == null || bombInfo.rotate.speed <= 0)
        {
            GetComponent <BombRotate>().enabled = false;
        }
        else
        {
            GetComponent <BombRotate>().enabled = true;
            GetComponent <BombRotate>().SetRotateData(bombInfo.rotate);
        }
    }
Ejemplo n.º 11
0
 void InitBomb(ref BaseBomb bombToInit, BaseTile tile)
 {
     bombToInit.tile = tile;
     tile.AddObjectToTile(bombToInit);
     bombToInit.modifierProperties(ModifierDamageRange, ModifierDamageDuration, ModifierDamageValue);
 }