Exemplo n.º 1
0
        public Projectile CreateProjectile(ProjectileDesc desc, ushort container, int dmg, int pen, long time, Position pos,
                                           float angle, ActivateAbility abil = null)
        {
            var ret = new Projectile(Manager, desc) //Assume only one
            {
                ProjectileOwner = this,
                ProjectileId    = projectileId++,
                abil            = abil,
                Container       = container,
                Damage          = dmg,
                Penetration     = pen,
                BeginTime       = time,
                BeginPos        = pos,
                Angle           = angle,
                X = pos.X,
                Y = pos.Y
            };

            if (projectiles[ret.ProjectileId] != null)
            {
                projectiles[ret.ProjectileId].Destroy(true);
            }
            projectiles[ret.ProjectileId] = ret;
            return(ret);
        }
Exemplo n.º 2
0
 public AcidBomb(Player player, ActivateAbility abil)
     : base(player.Manager, 0x2013)
 {
     this.abil   = abil;
     this.radius = abil.Radius;
     this.player = player;
 }
Exemplo n.º 3
0
        public Burn(Enemy enemy, ActivateAbility abil)
        {
            this.abil  = abil;
            this.enemy = enemy;

            remainingDmg = (int)StatsManager.GetEnemyDamage(enemy, abil.TotalDamage, enemy.ObjectDesc.Defense, enemy.ObjectDesc.Resilience, 0);
            perDmg       = remainingDmg * 1000 / abil.DurationMS;
        }
Exemplo n.º 4
0
 public static void PutDownPiece()
 {
     if (selected == null)
     {
         return;
     }
     HidePathDots();
     selected.transform.position -= GameController.raiseVector;
     if (!oldLocation.activeSelf && previousSprite != null)
     {
         oldLocation.SetActive(true);
     }
     ActivateAbility.DeactivateButton();
     pieceInfo.selected = true; // Not false!!!
     selected           = null;
 }
Exemplo n.º 5
0
 public void UseTactic(int caller)
 {
     if (MovementController.selected != null)
     {
         MovementController.PutDownPiece();
     }
     if (ActivateAbility.activated)
     {
         ActivateAbility.DeactivateButton();
     }
     if (OnEnterGame.current_tactic != -1 && targets.Count != 0)
     {
         Resume();
     }
     else
     {
         TacticTrigger trigger = tacticObj.GetComponent <TacticInfo>().trigger;
         if (!trigger.needsTarget && Time.time - prevClick < doubleClickInterval)
         {
             if (!GameController.ChangeOre(-trigger.tactic.oreCost) || !GameController.ChangeCoin(-trigger.tactic.goldCost))
             {
                 return;
             }
             trigger.Activate();
             GameController.RemoveTactic(trigger.tactic, true);
         }
         else
         {
             OnEnterGame.current_tactic           = caller;
             button.GetComponent <Image>().sprite = button.spriteState.highlightedSprite;
             targets = trigger.ValidTargets();
             if (targets.Count != 0)
             {
                 ActivateAbility.ShowTacticTarget(targets, caller, trigger);
             }
         }
     }
     infoCard.SetActive(false);
     prevClick = Time.time;
 }
Exemplo n.º 6
0
 public static void Resume()
 {
     OnEnterGame.CancelTacticHighlight();
     ActivateAbility.RemoveTargets();
     targets.Clear();
 }
Exemplo n.º 7
0
 private void Update()
 {
     if (Input.GetKeyUp(KeyCode.Escape))
     {
         settingsPanel.SetActive(true);
         MovementController.PutDownPiece();
         return;
     }
     if (OnEnterGame.gameInfo.gameOver ||
         !OnEnterGame.gameInfo.gameStarts ||
         onEnterGame.askTriggerPanel.activeSelf)
     {
         return;
     }
     // Database Down Error
     //if (OnEnterGame.gameInfo.currentTurn != Login.playerID)
     //{
     //    GameEvent gameEvent = GameEvent.Download();
     //    if (gameEvent != null) DecodeGameEvent(gameEvent);
     //    return;
     //}
     if (Input.GetMouseButtonUp(0))
     {
         Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         RaycastHit hit;
         if (Physics.Raycast(ray, out hit))
         {
             Collider hitObj = hit.collider;
             if (hitObj == MovementController.selected)
             {
                 MovementController.PutDownPiece();                                        //Click the same object is also considered a PutDown
             }
             else if (hitObj.name == "Piece" && hitObj.GetComponent <PieceInfo>().piece.IsAlly())
             {
                 pieceInfo = hitObj.GetComponent <PieceInfo>();
                 if (pieceInfo.piece.freeze > 0)
                 {
                     onEnterGame.ShowPieceFrozen();
                     return;
                 }
                 if (ActivateAbility.activated)
                 {
                     GameTacticGesture.Resume();
                 }
                 else if (MovementController.selected != null)
                 {
                     MovementController.PutDownPiece();                                           // switch piece
                 }
                 hit.collider.transform.position += raiseVector;
                 MovementController.selected      = hit.collider;
                 pieceInfo = hitObj.GetComponent <PieceInfo>();
                 MovementController.pieceInfo = ActivateAbility.pieceInfo = pieceInfo;
                 pieceInfo.HideInfoCard();
                 ActivateAbility.ActivateButton();
                 MovementController.validLocs = pieceInfo.ValidLoc();
                 MovementController.DrawPathDots();
             }
             else
             {
                 if (hitObj.name == "UIPanel")
                 {
                     return;
                 }
                 Location location;
                 if (hitObj.name == "Piece")
                 {
                     location = new Location(hitObj.transform.parent.name);
                 }
                 else
                 {
                     if (!Location.CorrectFormat(hitObj.name))
                     {
                         return;
                     }
                     location = new Location(hitObj.name);
                 }
                 if (MovementController.selected != null && !ActivateAbility.activated)
                 {
                     OnEnterGame.gameInfo.Act("move", Login.playerID);
                     MovementController.MoveTo(location);
                     // Database Down Error
                     //if (!OnEnterGame.gameInfo.Actable(Login.playerID)) onEnterGame.NextTurn();
                 }
                 else if (ActivateAbility.activated)
                 {
                     OnEnterGame.gameInfo.Act(ActivateAbility.actor, Login.playerID);
                     ActivateAbility.Activate(location);
                     // Database Down Error
                     //if (!OnEnterGame.gameInfo.Actable(Login.playerID)) onEnterGame.NextTurn();
                 }
             }
         }
     }
     else if (Input.GetMouseButtonUp(1))
     {
         if (MovementController.selected != null)
         {
             MovementController.PutDownPiece();
             if (ActivateAbility.activated)
             {
                 ActivateAbility.RemoveTargets();
             }
         }
         else if (OnEnterGame.current_tactic != -1)
         {
             GameTacticGesture.Resume();
         }
     }
 }