예제 #1
0
    private bool MoveToNewPlace()
    {
        float   radius = (110 - animal.GetIntimateLevel()) * 0.1f;
        Vector3 point;

        if (RandomPoint(new Vector3(playerTransform.position.x, 0, playerTransform.position.z), radius, out point))
        {
            Debug.Log("radius is : " + radius);
            Debug.DrawRay(point, Vector3.up, Color.blue, 1.0f);
        }

        if (agent.isActiveAndEnabled)
        {
            agent.SetDestination(point);
            agent.speed = speed;
            return(true);
        }
        return(false);
    }
예제 #2
0
    // Update is called once per frame
    void Update()
    {
        Debug.Log(lastIntimateLevel);
        timer += Time.deltaTime;
        float curIntimateLevel = animal.GetIntimateLevel();

        if (curIntimateLevel - lastIntimateLevel >= 10)
        {
            lastIntimateLevel = curIntimateLevel;
            Instantiate(smileFace);
        }
        else if (lastIntimateLevel - curIntimateLevel >= 10)
        {
            lastIntimateLevel = curIntimateLevel;
            Instantiate(angryFace);
        }
        else if (curIntimateLevel == 100 && lastIntimateLevel == 100 && timer > 10f)
        {
            timer = 0f;
            Instantiate(loveFace);
        }
    }
예제 #3
0
 // Use this for initialization
 void Start()
 {
     animal            = this.GetComponent <BaseAnimal>();
     lastIntimateLevel = animal.GetIntimateLevel();
 }