예제 #1
0
    public void SelectedUnit(GameObject g, Vector3 hitPoint, bool ignoreEmeny, bool replaceGroup)
    {
        UnitRender s    = g.GetComponent <UnitRender>();
        ForceMark  mark = DataManager.GetInstance().GetForceMark();
        long       id   = s.id;

        if (!ignoreEmeny && s.mark != mark)
        {
            // enemy
            // TODO: change the position to logic unit
            DebugUtils.Log(DebugUtils.Type.Battle, string.Format(" Set {0} {1} {2} as target, will change the unit target to this unit", s.mark, s.unitRenderType, id));

            logicWorld.ChangeTarget(mark, id, (LogicUnitType)s.unitRenderType);
        }
        else
        {
            // friendly force
            if (s.unitRenderType == UnitRenderType.Soldier)
            {
                logicWorld.SelectedUnit(mark, id, replaceGroup);
            }
            else
            {
                if (s.unitRenderType == UnitRenderType.Tower)
                {
                    logicWorld.TapTower(mark, id);
                }
                else if (s.unitRenderType == UnitRenderType.Institute)
                {
                    logicWorld.TapInstitute(mark, id);
                }
            }
        }
    }
예제 #2
0
 public void SetCardItem(SpecialCardItem item)
 {
     specialCard = item;
     ClickHandler.Get(item.gameObject).onClickDown = OnClickDown;
     ClickHandler.Get(item.gameObject).onClickUp   = OnClickUp;
     mark = DataManager.GetInstance().GetForceMark();
 }
예제 #3
0
    // if soldier group not empty and not the block, will move the group to there
    public void TapGround(Vector3 pos, PathType pathType)
    {
        ForceMark mark = DataManager.GetInstance().GetForceMark();

        DebugUtils.Log(DebugUtils.Type.Battle, string.Format(" Player tap ground, will change the soldier group to target position = {0} , pathType = {1}", pos, pathType));
        logicWorld.ChangeDestination(mark, pos, pathType);
    }
예제 #4
0
        // Get one in the object pool
        public HealthBar GetHealthBar(ForceMark mark)
        {
            HealthBar bar = healthBarPool.GetObject();

            bar.Refresh(GetPoolByMark(mark));
            return(bar);
        }
예제 #5
0
        public MiniMapController(MiniMapView view)
        {
            this.view = view;

            selfMark = view.selfMark;
            selfSide = view.datamanager.GetMatchSide();

            MessageDispatcher.AddObserver(GenerateSoldierInMinimap, MessageType.GenerateSoldier);
            MessageDispatcher.AddObserver(BuildTowerInMinimap, MessageType.BuildTower);
            MessageDispatcher.AddObserver(BuildTownInMinimap, MessageType.BuildTown);
            MessageDispatcher.AddObserver(BuildInstituteMinimap, MessageType.BuildInstitute);
            MessageDispatcher.AddObserver(CreatePowerUp, MessageType.SpawnPowerUp);
            MessageDispatcher.AddObserver(GenerateSoldierInMinimap, MessageType.BuildTramCar);
            MessageDispatcher.AddObserver(GenerateSoldierInMinimap, MessageType.BuildDemolisher);

            MessageDispatcher.AddObserver(CreateEffectInMiniMap, MessageType.CreateMiniMapEffect);
            MessageDispatcher.AddObserver(DestroyEffect, MessageType.MiniMapEffectDestroy);

            MessageDispatcher.AddObserver(DestorySoldier, MessageType.SoldierDeath);
            MessageDispatcher.AddObserver(DestoryTower, MessageType.TowerDestroyed);
            MessageDispatcher.AddObserver(DestoryTown, MessageType.TownDestroy);
            MessageDispatcher.AddObserver(DestroyInstitute, MessageType.InstituteDestroyed);
            MessageDispatcher.AddObserver(DestroyPowerUp, MessageType.PowerUpDestroyed);
            MessageDispatcher.AddObserver(DestroyEngineeringVehicles, MessageType.DemolisherDestroyed);
            MessageDispatcher.AddObserver(DestroyEngineeringVehicles, MessageType.TramCarDestroyed);

            MessageDispatcher.AddObserver(SyncPositionInMinimap, MessageType.ChangeSoldierPosition);
        }
예제 #6
0
        public void Reset()
        {
            battlers.Clear();
            dataList.Clear();

            if (frames != null)
            {
                frames.Clear();
            }

            simulateBattle = false;

            battleType = BattleType.NoBattle;
            side       = MatchSide.NoSide;
            forceMark  = ForceMark.NoneForce;
            id         = 0;
            frame      = 0;

            killUnitCount = 0;
            fatality      = 0;
            mvpValue      = 0;
            resources     = 0;
            institeLv     = 0;

            pveWaveNumber = 0;
            pveIsVictory  = false;

            simulateBattle = false;
            battleDuration = 0;
        }
예제 #7
0
        private void GetEffects(ForceMark mark)
        {
            BattleType type = DataManager.GetInstance().GetBattleType();

            if (type != BattleType.Survival && type != BattleType.Tranining)
            {
                if (mark == ForceMark.TopRedForce || mark == ForceMark.BottomRedForce)
                {
                    buildEffect  = transform.Find(string.Format("redbase_operation_1")).gameObject;
                    finishEffect = transform.Find(string.Format("redbase_operation_2")).gameObject;
                    deathEffect  = transform.Find(string.Format("redbase_death")).gameObject;
                    crystal      = transform.Find("RedBase_crystal").gameObject;
                }
                else if (mark == ForceMark.TopBlueForce || mark == ForceMark.BottomBlueForce)
                {
                    buildEffect  = transform.Find(string.Format("bluebase_operation_1")).gameObject;
                    finishEffect = transform.Find(string.Format("bluebase_operation_2")).gameObject;
                    deathEffect  = transform.Find(string.Format("bluebase_death")).gameObject;
                    crystal      = transform.Find("BlueBase_crystal").gameObject;
                }
                else
                {
                    DebugUtils.LogError(DebugUtils.Type.Building, string.Format("Can't find this type side {0}", mark));
                }
            }
        }
예제 #8
0
    public CameraInvertType GetCameraInvertType(ForceMark mark)
    {
        // Only flip horizontal now
        CameraInvertType type = CameraInvertType.None;

        switch (mark)
        {
        case ForceMark.TopRedForce:
        {
            type = CameraInvertType.Horizontal;
            break;
        }

        case ForceMark.BottomRedForce:
        {
            type = CameraInvertType.Horizontal;
            break;
        }

        case ForceMark.TopBlueForce:
        {
            type = CameraInvertType.None;
            break;
        }

        case ForceMark.BottomBlueForce:
        {
            type = CameraInvertType.None;
            break;
        }
        }

        return(type);
    }
예제 #9
0
    public void CloseDeployAreas(object s)
    {
        ForceMark mark = ( ForceMark )s;

        if (mark == ForceMark.TopBlueForce)
        {
            topBlueDeployArea.SetActive(false);
        }
        else if (mark == ForceMark.TopRedForce)
        {
            topRedDeployArea.SetActive(false);
        }
        else if (mark == ForceMark.BottomBlueForce)
        {
            bottomBlueDeployArea.SetActive(false);
        }
        else if (mark == ForceMark.BottomRedForce)
        {
            bottomRedDeployArea.SetActive(false);
        }
        else
        {
            DebugUtils.LogError(DebugUtils.Type.Map, "The operation's owner has error forceMark" + mark);
        }
    }
예제 #10
0
        public void Initialize(long id, FixVector3 pos, FixVector3 rot, bool isPlusCrystal)
        {
            this.id = id;
            type    = LogicUnitType.Crystal;
            state   = BuildingState.IDLE;

            ownerMark             = ForceMark.NoneForce;
            transform.position    = pos.vector3;
            transform.eulerAngles = rot.vector3;
            position    = pos;
            crystalPlus = isPlusCrystal;
            modelRadius = ConvertUtils.ToLogicInt(GameConstants.CRYSTAL_MODELRADIUS);

            if (isPlusCrystal)
            {
                modelId    = GameConstants.CRYSTAL_BIG_RESOURCEID;
                maxHp      = GameConstants.CRYSTAL_BIG_RESERVES;
                rebornTime = GameConstants.CRYSTAL_BIG_RECOVERTIME;
            }
            else
            {
                modelId    = GameConstants.CRYSTAL_SMALL_RESOURCEID;
                maxHp      = GameConstants.CRYSTAL_SMALL_RESERVES;
                rebornTime = GameConstants.CRYSTAL_SMALL_RECOVERTIME;
            }

            removeOwnerInterval = GameConstants.CRYSTAL_REMOVEOWNER_INTERVAL;

            hp = maxHp;
        }
예제 #11
0
    public void ChangeUnitTarget(long currentDragUnit, GameObject target)
    {
        UnitRender targetRender = target.GetComponent <UnitRender>();
        ForceMark  mark         = DataManager.GetInstance().GetForceMark();

        logicWorld.ChangeTarget(mark, currentDragUnit, targetRender.id, (LogicUnitType)targetRender.unitRenderType);
    }
예제 #12
0
 public int GetUnitResources(ForceMark mark)
 {
     if (dataList.ContainsKey(mark))
     {
         return(dataList[mark].unitResources);
     }
     return(0);
 }
예제 #13
0
 public int GetUnitFatality(ForceMark mark)
 {
     if (dataList.ContainsKey(mark))
     {
         return(dataList[mark].unitFatality);
     }
     return(0);
 }
예제 #14
0
 public int GetUnitKillCount(ForceMark mark)
 {
     if (dataList.ContainsKey(mark))
     {
         return(dataList[mark].unitKillCount);
     }
     return(0);
 }
예제 #15
0
 private bool GetIsSameSide(ForceMark orderForceMark)
 {
     if (GetSideFromMark(orderForceMark) == selfSide)
     {
         return(true);
     }
     return(false);
 }
예제 #16
0
        //Now just use for anti-Tower.If need more logic, need new message support.
        private void PassiveDetectionAI(object mark, object playerID, object v3Pos)
        {
            ForceMark playerMark = ( ForceMark )mark;

            if (playerMark == ForceMark.TopBlueForce && !isHaveSigeCar)
            {
                AntiTower();
            }
        }
예제 #17
0
 // When you no longer use this item Call it
 public void RemoveHealthBar(ForceMark mark, HealthBar bar)
 {
     if (bar == null)
     {
         return;
     }
     bar.SetActive(false);
     healthBarPool.DisposeObject(bar);
 }
예제 #18
0
        private void ReceiveSquads(object cardsObj, object waitingCardObj)
        {
            List <SquadData> currentCards = (List <SquadData>)cardsObj;
            SquadData        waitingCard  = (SquadData)waitingCardObj;

            mark = DataManager.GetInstance().GetForceMark();

            _view.SetInitialSquads(currentCards, waitingCard);
            _view.InitSpecialCard();
        }
예제 #19
0
 public void SetRotation(ForceMark mark)
 {
     if (mark == ForceMark.BottomBlueForce || mark == ForceMark.TopBlueForce)
     {
         transform.rotation = Quaternion.Euler(0f, 90f, 0f);
     }
     else
     {
         transform.rotation = Quaternion.Euler(0f, -90f, 0f);
     }
 }
예제 #20
0
        public void Initialize(long id, ForceMark mark, int metaId, int index)
        {
            this.id     = id;
            this.mark   = mark;
            this.metaId = metaId;
            this.index  = index;

            startTimingRecycle = false;

            unitRenderType = UnitRenderType.Skill;
        }
예제 #21
0
 public List <Vector3> GetFormationPoint(ForceMark mark)
 {
     if (mark == ForceMark.TopRedForce)
     {
         return(redFormationPointList);
     }
     else
     {
         return(blueFormationPointList);
     }
 }
예제 #22
0
 public override void Reset()
 {
     id                = -1;
     rebornTimer       = 0;
     state             = BuildingState.NONE;
     ownerMark         = ForceMark.NoneForce;
     removeOwnerTimer  = 0;
     maxHp             = 0;
     hp                = maxHp;
     crystalPlus       = false;
     PostRenderMessage = null;
 }
예제 #23
0
 private bool IsEnemyDead(ForceMark self, ForceMark other)
 {
     if (GetSideFromMark(self) == MatchSide.Red && GetSideFromMark(other) == MatchSide.Blue)
     {
         return(true);
     }
     else if (GetSideFromMark(self) == MatchSide.Blue && GetSideFromMark(other) == MatchSide.Red)
     {
         return(true);
     }
     return(false);
 }
예제 #24
0
 private bool GetIsSameSide(ForceMark killerMark, ForceMark beKillerMark)
 {
     if (GetSideFromMark(killerMark) == selfSide && GetSideFromMark(beKillerMark) == enemySide)
     {
         return(true);
     }
     else if (GetSideFromMark(beKillerMark) == selfSide && GetSideFromMark(killerMark) == enemySide)
     {
         return(false);
     }
     return(false);
 }
예제 #25
0
    public long UnitCanBeDrag(GameObject g)
    {
        UnitRender s    = g.GetComponent <UnitRender>();
        ForceMark  mark = DataManager.GetInstance().GetForceMark();

        if (mark == s.mark && s.unitRenderType == UnitRenderType.Soldier)
        {
            return(s.id);
        }

        return(-2);
    }
예제 #26
0
    public bool UnitCanBeChase(GameObject g)
    {
        UnitRender s    = g.GetComponent <UnitRender>();
        ForceMark  mark = DataManager.GetInstance().GetForceMark();

        if (logicWorld.GetSideFromMark(mark) == logicWorld.GetSideFromMark(s.mark))
        {
            return(false);
        }

        return(true);
    }
예제 #27
0
        private void CreateEffectInMiniMap(object effectType, object id, object mark, object pos)
        {
            Vector3   vec3      = (Vector3)pos;
            Vector2   vec2      = new Vector2(vec3.x, vec3.z);
            ForceMark forceMark = (ForceMark)mark;

            DebugUtils.Log(DebugUtils.Type.MiniMap, string.Format("Receive createEffectInMiniMap, Type is {0} ", ( MiniMapEffectType )effectType));

            if (forceMark == selfMark)
            {
                view.CreateEffectIcon(( MiniMapEffectType )effectType, ( long )id, vec2);
            }
        }
예제 #28
0
 public void AddUnitResources(ForceMark mark, int emberCount)
 {
     if (dataList.ContainsKey(mark))
     {
         dataList[mark].unitResources += emberCount;
     }
     else
     {
         BattleNumData data = new BattleNumData();
         data.mark          = mark;
         data.unitResources = emberCount;
         dataList.Add(mark, data);
     }
 }
예제 #29
0
        public long battleDuration; // ms

        public Battle()
        {
            battlers = new List <Battler>();
            dataList = new Dictionary <ForceMark, BattleNumData>();

            battleType     = BattleType.NoBattle;
            side           = MatchSide.NoSide;
            forceMark      = ForceMark.NoneForce;
            id             = 0;
            frame          = 0;
            cameraHeight   = 16.5f;
            institeLv      = 0;
            battleDuration = 0;
        }
예제 #30
0
        public void ShowKillUnitNotice(ForceMark killerMark, int killerIcon, ForceMark beKillerMark, int beKillerIcon)
        {
            // TODO: Temp Code
            if (killerIcon == 0 || beKillerIcon == 0)
            {
                return;
            }
            if (killerIcon == -1 || beKillerIcon == -1)
            {
                return;
            }

            ShowKillUnitNotice(KillDesType.Kill, killerIcon, beKillerIcon, GetIsSameSide(killerMark, beKillerMark));
        }