示例#1
0
    void UnHighlight()
    {
        FollowSelectedTeddy wisp = FindObjectOfType <FollowSelectedTeddy>();

        if (wisp)
        {
            wisp.UnSetTarget();
        }
    }
示例#2
0
    public void UnTarget()
    {
        TeddyState teddy_state = _target.GetComponent <TeddyState>();

        if (teddy_state)
        {
            teddy_state.state = TeddyState.State.DEAD;
        }
        _target = null;
        _wisp.UnSetTarget();
    }
示例#3
0
    // Update is called once per frame
    void Update()
    {
        // SPECIAL FOR THE TUTORIAL TEDDY
        // TODO: MAKE IT NOT HARD CODED... unless we don't actually have to
        state.selectable = false;
        state.facing     = TeddyState.Facing.RIGHT;

        if (_wisp == null)
        {
            _wisp = FindObjectOfType <FollowSelectedTeddy>();
        }


        Ray   ray_down = new Ray(transform.position, new Vector3(0.0f, -1.0f));
        float distance = (transform.position - player.transform.position).magnitude;

        //Debug.Log(distance + " > " + max_dist_to_player + " : " + (distance > max_dist_to_player));
        if (distance > max_dist_to_player)
        {
            state.state = TeddyState.State.WAITING;
            if (_wisp)
            {
                _wisp.UnSetTarget();
            }
        }
        else if (distance < trigger_dist_to_player)
        {
            if (_wisp)
            {
                _wisp.SetTarget(gameObject);
            }
            if (state.facing == TeddyState.Facing.RIGHT)
            {
                state.state = TeddyState.State.MOVING_RIGHT;
            }
            else
            {
                state.state = TeddyState.State.MOVING_LEFT;
            }
        }
    }