示例#1
0
 void Start()
 {
     hoge = false;
      		if (this.gameObject.tag == "CareTool"){
         abstractCareTool = this.gameObject.GetComponent<AbstractCareTool>();
     }
     if (this.gameObject.tag == "Meal"){
         abstractMeal = this.gameObject.GetComponent<AbstractMeal>();
     }
     pet = GameObject.Find ("Pet");
     _abstractPet = pet.GetComponent<AbstractPet>();
 }
示例#2
0
    public void Play(AbstractCareTool careTool)
    {
        timeManager = GameObject.Find ("TimeManager");
        timeManagerScript = timeManager.GetComponent<TimeManager>();
        string careToolName = careTool.GetType ().FullName;
        if(move == null){
            move = new GameObject();
            string toolName = careTool.GetType ().FullName;
            if (toolName == "Ball"){
                move.name = "mBall";
            }else if (toolName == "Branch"){
                move.name = "mBranch";
            }else if (toolName == "Ring"){
                move.name = "mRing";
            }else if (toolName == "Bone"){
                move.name = "mBone";
            }else if (toolName == "Brush"){
                move.name = "mBrush";
            }
            move.AddComponent(typeof(CareToolMotion));
            move.AddComponent<Animator>();
            move.GetComponent<Animator>().runtimeAnimatorController = RuntimeAnimatorController.Instantiate(Resources.Load<RuntimeAnimatorController>("Animation/tool/toolanim"));
        }

        if(isPlaying == false){
            if(careToolName != likeCare && careToolName != dislikeCare){
                friendship += (int)(careTool.GetFriendshipPoint() / level);
            }else if(careToolName == likeCare){
                friendship += (int)(careTool.GetFriendshipPoint() * 1.5 / level);
            }else if(careToolName == dislikeCare){
                friendship += (int)(careTool.GetFriendshipPoint() * 0.5 / level);
            }
            fat -= 30;
            isPlaying = true;
            timeManagerScript.careStartTime = DateTime.Now;
            if(careToolName != "Aidkit"){
                GameObject.Find("Balloon").GetComponent<Balloon>().StartCoroutine("hideBalloon", 4);
                RandomBreaking();
            }
        }
        if(isBreaking == true && isTreated == false && careToolName == "Aidkit"){
            StartCoroutine("TreatInjured");
            GameObject.Find("Balloon").GetComponent<Balloon>().StartCoroutine("changeTextureThanks");
            isTreated = true;
            isBreaking = false;
            friendship += (int)(careTool.GetFriendshipPoint() / level);
        }
    }