public void PushMeatType(int choiseFoodRank) { if (MeetNums[choiseFoodRank] == 0) { return; } canEatNum -= 1; --MeetNums[choiseFoodRank]; SetFoodText(); Food.GetComponent <Image>().sprite = FoodSprite[choiseFoodRank]; if (foodType == 0) { foodCommentType = FoodCommentType.LIKE; TalkText.text = talkComment[0]; switch (choiseFoodRank) { case 0: satietyLelel += 1; break; case 1: satietyLelel += 2; loveLevel += 1; break; case 2: satietyLelel += 3; loveLevel += 2; break; } } else { foodCommentType = FoodCommentType.DONT_LIKE; TalkText.text = talkComment[1]; } if (satietyLelel > maxSatietyLevel) { satietyLelel = maxSatietyLevel; } if (loveLevel > maxLoveLevel) { loveLevel = maxLoveLevel; } EatManager.Change(satietyLelel, maxSatietyLevel); EatBoard.SetActive(false); Food.SetActive(true); isAnimation = true; animationType = Type.EAT; }
void UpdateBrush() { if (isAnimation != true) { return; } if (animationType != Type.BRUSH) { return; } Vector2 mousePosition = new Vector2(Input.mousePosition.x, Input.mousePosition.y); Vector2 prevMousePos = new Vector2(prevMousePosition.x, prevMousePosition.y); if (Brush.GetComponent <DragMover>().IsDragging == true) { if (prevMousePos != mousePosition) { Sound.PlaySe("brush"); RectTransform myTransform = Brush.GetComponent <RectTransform>(); Rect rect = new Rect(myTransform.position.x, myTransform.position.y, myTransform.rect.width, myTransform.rect.height); if (rect.position.x <= mousePosition.x && mousePosition.x <= rect.position.x + rect.width && rect.position.y <= mousePosition.y && mousePosition.y <= rect.position.y + rect.height) { BrushTime += Time.deltaTime; prevMousePosition = new Vector3(mousePosition.x, mousePosition.y, 0); } } } Debug.Log(BrushTime); if (BrushTime < 1.5f) { return; } animationType = Type.COMMENT; Brush.GetComponent <RectTransform>().position = BrushPos; BrushTime = 0.0f; Brush.SetActive(false); CommentBoard.SetActive(true); MakeHeart(2); foodCommentType = FoodCommentType.LIKE; Brush.GetComponent <RectTransform>().position = BrushPos; Brush.GetComponent <DragMover>().IsDragging = false; if (loveLevel + 1 <= maxLoveLevel) { loveLevel += 1; Sound.PlaySe("loveup"); HeartManager.SetAnimation(loveLevel - 1, loveLevel, maxLoveLevel); } }
void UpdateComment() { if (isAnimation != true) { return; } if (animationType != Type.COMMENT) { return; } animationTime += Time.deltaTime; if (foodCommentType == FoodCommentType.LIKE) { heartMakeTime += Time.deltaTime; if (heartMakeTime > 0.5f) { heartMakeTime = 0.0f; MakeHeart(2); } } else if (foodCommentType == FoodCommentType.DONT_LIKE) { Moya.GetComponent <RectTransform>().sizeDelta += new Vector2(0, 0.4f); } if (animationTime < 2.5f) { return; } animationTime = 0.0f; isAnimation = false; animationType = Type.NONE; CommentBoard.SetActive(false); isSelectButton = false; if (foodCommentType == FoodCommentType.DONT_LIKE) { Moya.SetActive(false); Moya.GetComponent <RectTransform>().sizeDelta = moyaSize; foodCommentType = FoodCommentType.NONE; } else if (foodCommentType == FoodCommentType.LIKE) { heartMakeTime = 0.0f; foodCommentType = FoodCommentType.NONE; } }