public void SetDrawMessageStyle(string message, MessageStyle drawStyle, int drawStyleIndex) { if (drawStyleIndex >= 0 && drawStyleIndex < this.drawStyleListValue.Count) { DrawMessageStyle drawMessageStyle = this.drawStyleListValue[drawStyleIndex]; int oldWidthValue = drawMessageStyle.Width; drawMessageStyle.SetDrawMessageStyle(message, drawStyle.Width); this.widthValue = this.widthValue - oldWidthValue + drawMessageStyle.Width; if (this.heightValue < drawStyle.Height) { this.heightValue = drawStyle.Height; } else { this.heightValue = 0; foreach (DrawMessageStyle drawStyleTemp in this.drawStyleListValue) { if (this.heightValue < drawStyleTemp.Height) { this.heightValue = drawStyleTemp.Height; } } } this.moveState = MoveStateType.NotMove; } }
public void Move() { DistanceToPlayer = Vector3.Distance(this.transform.position, TargetShip.position); var ForwardVec = this.transform.position.normalized; if (DistanceToPlayer >= Distance2) { MoveState = MoveStateType.RushToPlayer; } else if (DistanceToPlayer >= Distance1 && DistanceToPlayer < Distance2) { MoveState = MoveStateType.StayAway; } else if (DistanceToPlayer < Distance1) { MoveState = MoveStateType.RushToPlayer; } if (_EnemyShip.ReachBorder()) { HitBoard = 1.5f; } if (PlayerShip.OnGetArmour() <= 0) { ForwardVec = (TargetShip.position - this.transform.position).normalized; } else { if (HitBoard > 0) { HitBoard = HitBoard - 0.01f; //ForwardVec = (Vector3.Scale(TargetShip.position - this.transform.position, new Vector3(-1f, 1f, 1f))).normalized; ForwardVec = (TargetShip.position - this.transform.position).normalized; } else { switch (MoveState) { case MoveStateType.Idle: break; case MoveStateType.StayAway: ForwardVec = (this.transform.position - TargetShip.position).normalized; break; case MoveStateType.RushToPlayer: ForwardVec = (TargetShip.position - this.transform.position).normalized; break; } } } _EnemyShip.MoveTo(ForwardVec); _EnemyShip.StartMoving(); Debug.Log(" : " + PlayerShip.OnGetArmour()); }
public void ResetMoveState() { moveState = MoveStateType.IN_PROGRESS; }
public void CompleteMove() { moveState = MoveStateType.COMPLETED; }
public void MoveMessage(int moveNumber) { if (this.slidingSpeedValue == 0 || IniFileInfo.MoveMessage == false || moveDirectionValue == MoveDirectionStyle.None) { #region "not move" if (parentTempleteValue.CheckTempleteState() == TempleteStateType.Stop) { moveState = MoveStateType.MoveFinish; parentTempleteValue.ExecuteStop(); } else { this.leftValue = (this.parentWidthValue - this.widthValue) / 2; moveState = MoveStateType.Moving; } #endregion } else { #region "right left " if (moveDirectionValue == MoveDirectionStyle.RightToLeft || moveDirectionValue == MoveDirectionStyle.LeftToRight) { int sepValue = (this.parentWidthValue + this.widthValue) / (moveNumber * this.slidingSpeedValue); if (sepValue < 1) { sepValue = 1; } if (moveDirectionValue == MoveDirectionStyle.RightToLeft) { #region "right to left " this.leftValue = this.leftValue - sepValue; if (this.leftValue <= -this.widthValue) { if (parentTempleteValue.CheckTempleteState() == TempleteStateType.Stop) { moveState = MoveStateType.MoveFinish; parentTempleteValue.ExecuteStop(); } else { this.leftValue = this.parentWidthValue; moveState = MoveStateType.Moving; } } else { moveState = MoveStateType.Moving; } #endregion } else if (moveDirectionValue == MoveDirectionStyle.LeftToRight) { #region "right to left " this.leftValue = this.leftValue + sepValue; if (this.leftValue > this.parentWidthValue) { if (parentTempleteValue.CheckTempleteState() == TempleteStateType.Stop) { moveState = MoveStateType.MoveFinish; parentTempleteValue.ExecuteStop(); } else { this.leftValue = -this.widthValue; moveState = MoveStateType.Moving; } } else { moveState = MoveStateType.Moving; } #endregion } } #endregion #region "down top " if (moveDirectionValue == MoveDirectionStyle.DownToTop || moveDirectionValue == MoveDirectionStyle.TopToDown) { int sepValue = (this.parentHeightValue + this.heightValue) / (moveNumber * this.slidingSpeedValue); if (sepValue < 1) { sepValue = 1; } if (moveDirectionValue == MoveDirectionStyle.DownToTop) { #region "down to top " this.topValue = this.topValue - sepValue; if (this.topValue <= -this.heightValue) { if (parentTempleteValue.CheckTempleteState() == TempleteStateType.Stop) { moveState = MoveStateType.MoveFinish; parentTempleteValue.ExecuteStop(); } else { this.topValue = this.parentHeightValue; moveState = MoveStateType.Moving; } } else { moveState = MoveStateType.Moving; } #endregion } else if (moveDirectionValue == MoveDirectionStyle.TopToDown) { #region "right to left " this.topValue = this.topValue + sepValue; if (this.topValue > this.parentHeightValue) { if (parentTempleteValue.CheckTempleteState() == TempleteStateType.Stop) { moveState = MoveStateType.MoveFinish; parentTempleteValue.ExecuteStop(); } else { this.topValue = -this.heightValue; moveState = MoveStateType.Moving; } } else { moveState = MoveStateType.Moving; } #endregion } } #endregion } if (needRefreshLocation) { RefreshLocation(); } }
public void Correction(Point position, MoveStateType moveState, DirectionType direction) { _currentPosition = position; MoveState = moveState; Direction = direction; }