Exemplo n.º 1
0
 /// <summary>
 /// Moves to the given coordinate and update the unit's world position
 /// </summary>
 /// <param name="coord">Cell coordinate</param>
 /// <param name="worldPosition">World position</param>
 public virtual void MoveTo(CellCoordinate coord, Vector3 worldPosition)
 {
     GameLogger.Instance.AddMove(ActionRecord.MoveAction(this, this.Coordinate, coord));
     this.Coordinate     = coord;
     this.AnimationState = AnimationState.Move;
     this.targetPosition = worldPosition;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Attacks another unit
        /// </summary>
        /// <param name="unit">Unit to attack</param>
        protected override void Attack(Unit unit)
        {
            GameLogger.Instance.AddMove(ActionRecord.AttackAction(this, this.Coordinate, unit, unit.Coordinate));

            this.AnimationState = AnimationState.Attack;
            this.StartCoroutine(this.AnimateAttack(
                                    unit,
                                    () =>
            {
                this.AnimationState = AnimationState.Idle;
                unit.Health        -= this.AttackPower;
            }));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Heals another unit
        /// </summary>
        /// <param name="unit">Unit to heal</param>
        protected void Heal(Unit unit)
        {
            GameLogger.Instance.AddMove(ActionRecord.HealAction(this, this.Coordinate, unit, unit.Coordinate));

            this.AnimationState = AnimationState.Heal;
            this.HealParticles.Play();

            Vector3 particlePos = unit.transform.position;

            particlePos.y += 3;
            this.HealTargetParticles.transform.position = particlePos;
            this.HealTargetParticles.Play();

            unit.Health        += this.HealPower;
            this.AnimationState = AnimationState.Idle;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Attacks another unit
        /// </summary>
        /// <param name="unit">Unit to attack</param>
        protected override void Attack(Unit unit)
        {
            GameLogger.Instance.AddMove(ActionRecord.AttackAction(this, this.Coordinate, unit, unit.Coordinate));
            this.LookAt(unit.transform.position);

            this.AnimationState = AnimationState.Attack;
            var bullet = (GameObject)Instantiate(this.Bullet);

            bullet.transform.position = this.BulletSpawn.transform.position;
            this.StartCoroutine(bullet.GetComponent <BulletController>().SendTo(
                                    unit.transform.position,
                                    () =>
            {
                this.AnimationState = AnimationState.Idle;
                unit.Health        -= this.AttackPower;
            }));
        }
Exemplo n.º 5
0
 /// <summary>
 /// Attacks another unit
 /// </summary>
 /// <param name="unit">Unit to attack</param>
 protected virtual void Attack(Unit unit)
 {
     GameLogger.Instance.AddMove(ActionRecord.AttackAction(this, this.Coordinate, unit, unit.Coordinate));
     unit.Health -= this.AttackPower;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Add a move to the log
 /// </summary>
 /// <param name="move">Move to add</param>
 public void AddMove(ActionRecord move)
 {
     this.CurrentTurn.Moves.Add(move);
 }