private void Start() { Bone.parent = this; m_fishStatus = GetComponent <FishStatus>(); Bone.model.transform.localScale = Bone.model.transform.localScale * (m_fishStatus.getSize() / ((m_fishStatus.maxSize + m_fishStatus.minSize) / 2f)); m_rigidBody = GetComponent <Rigidbody>(); m_rigidBody.angularDrag = 10f; if (m_parentHook) { m_parentRod = m_parentHook.GetParentRod; } else { Destroy(gameObject); } m_rod = m_parentHook.GetParentRod; StartCoroutine(C_AI()); }
public bool UpdateDescription(Guid fishGuid, string description, FishStatus status) { return(base.ExecuteCommand("UPDATE [dbo].[Fishes] SET [Description] = @Description,[Status] = @Status WHERE [Guid] = @Guid", "@Guid", fishGuid, "@Description", description, "@Status", (int)status)); }
public bool UpdateOnlineFish(Guid fishGuid, FishStatus fishStatus, long billNumber, Guid transactionGuid) { return(base.ExecuteSPCommand("UpdateOnlineFish", "@Guid", fishGuid, "@Status", (int)fishStatus, "@BillNumber", billNumber, "@TransactionGuid", transactionGuid)); }
// Use this for initialization void Start() { //mDelayActiveTime = float.MaxValue; //mCurrentLifeTime = 0; mStatus = FishStatus.Status_UnActive; transform.Rotate(0, 0, mCurRotation); mCurRotation = Mathf.Deg2Rad * mCurRotation; if (Mathf.Cos(mCurRotation) < 0) { gameObject.GetComponent <UITexture>().flip = UIBasicSprite.Flip.Vertically; } mPosX = transform.localPosition.x; mPosY = transform.localPosition.y; PathRender pathRender = this.GetComponent <PathRender>(); if (pathRender) { mFishPath = pathRender.FishPathData; mBaseSpeed = mFishPath.baseSpeed; } }
private void RealFishMove(GameTime gt, List <Items.FoodPellet> pList) { hungerTimer -= gt.ElapsedGameTime.TotalSeconds; if (closestPellet != null && closestPellet._CurrentState == SpriteState.kStateInActive) { closestPellet = null; fishStatus = FishStatus.kStatusRoam; } if (hungerTimer < 0) { Hunger++; hungerTimer = 0.5f; if (fishStatus == FishStatus.kStatusRoam) { if (hunger > 40) { fishStatus = FishStatus.kStatusFood; } } } if (fishStatus == FishStatus.kStatusRoam) { moveTimer -= gt.ElapsedGameTime.TotalSeconds; if (moveTimer <= 0) { moving = true; Random ran = new Random(); moveTimer = ran.Next(0, 8); targetPos.X = ran.Next(10, 750); targetPos.Y = ran.Next(85, 450); } } else if (fishStatus == FishStatus.kStatusFood) { if (pList.FindAll(x => x._CurrentState == SpriteState.kStateActive).Count > 0) { float closestDistance = 100000; foreach (Items.FoodPellet p in pList.FindAll(x => x._CurrentState == SpriteState.kStateActive)) { //find closest pellet. if (p._Position.Y < 70) { continue; } float currentDistance = Vector2.Distance(this.FishMouth.Location.ToVector2(), p._Position); if (currentDistance < closestDistance) { closestPellet = p; closestDistance = currentDistance; } } } if (closestPellet != null) { targetPos = closestPellet._Position; moving = true; if (closestPellet._CurrentState == SpriteState.kStateInActive || closestPellet._Position.Y < 70) { moving = false; if (_FlipX) { MyDir = CurrentDirection.kDirectionLeft; } else { MyDir = CurrentDirection.kDirectionRight; } } if (closestPellet._BoundingBox.Intersects(this.FishMouth)) { closestPellet.Deactivate(); closestPellet = null; Hunger -= 50; moving = false; fishStatus = FishStatus.kStatusRoam; this._Scale.X += 0.3f; this._Scale.Y += 0.3f; if (this._Scale.X > 2.0f) { this._Scale.X = 2.0f; this._Scale.Y = 2.0f; } } } else { fishStatus = FishStatus.kStatusRoam; } } //else if(fishStatus == FishStatus.kStatusDead) //{ // this._Rotation = MathHelper.ToRadians(180); // if(this._Position.Y > 70) // { // float speed = 100f; // this._Position.Y -= (float)(speed * gt.ElapsedGameTime.TotalSeconds); // } //} //if (InputHelper.LeftButtonClicked) //{ // moving = true; // targetPos = InputHelper.MouseScreenPos; //} //if(Hunger >= 100) //{ // this.fishStatus = FishStatus.kStatusDead; //} if (moving) { float speed = 100f; if (Math.Abs((this.FishMouth.Location.ToVector2().X - targetPos.X)) > 5) { if (this.FishMouth.Location.ToVector2().X < targetPos.X) { this._Position.X += speed * (float)gt.ElapsedGameTime.TotalSeconds; if (Math.Abs((this.FishMouth.Location.ToVector2().X - targetPos.X)) > 20) { this._FlipX = false; MyDir = CurrentDirection.kDirectionRight; } } else if (this.FishMouth.Location.ToVector2().X > targetPos.X) { this._Position.X -= speed * (float)gt.ElapsedGameTime.TotalSeconds; if (Math.Abs((this.FishMouth.Location.ToVector2().X - targetPos.X)) > 20) { this._FlipX = true; MyDir = CurrentDirection.kDirectionLeft; } } } if (Math.Abs((this.FishMouth.Location.ToVector2().Y - targetPos.Y)) > 5) { if (this.FishMouth.Location.ToVector2().Y < targetPos.Y) { this._Position.Y += speed * (float)gt.ElapsedGameTime.TotalSeconds; if (Math.Abs((this.FishMouth.Location.ToVector2().Y - targetPos.Y)) > 15) { if (_FlipX) { //this._Rotation = MathHelper.ToRadians(-45); MyDir = CurrentDirection.kDirectionLeft; } else { //this._Rotation = MathHelper.ToRadians(45); MyDir = CurrentDirection.kDirectionRight; } } } else if (this.FishMouth.Location.ToVector2().Y > targetPos.Y) { this._Position.Y -= speed * (float)gt.ElapsedGameTime.TotalSeconds; if (Math.Abs((this.FishMouth.Location.ToVector2().Y - targetPos.Y)) > 15) { if (_FlipX) { //this._Rotation = MathHelper.ToRadians(45); MyDir = CurrentDirection.kDirectionLeft; } else { //this._Rotation = MathHelper.ToRadians(-45); MyDir = CurrentDirection.kDirectionRight; } } } } else { this._Rotation = 0; } if (Vector2.Distance(this.FishMouth.Location.ToVector2(), targetPos) < 10) { moving = false; this._Rotation = 0; if (_FlipX) { MyDir = CurrentDirection.kDirectionLeft; } else { MyDir = CurrentDirection.kDirectionRight; } } } if (closestPellet != null) { pelletLastFrame = true; } else { pelletLastFrame = false; } }
void updateStatus(FishStatus status) { mStatus = status; }
public bool UpdateStatus(Guid fishGuid, FishStatus status, Guid transactionGuid) { return(base.ExecuteSPCommand("UpdateStatus", "@Guid", fishGuid, "@Status", (int)status, "@TransactionGuid", transactionGuid)); }