Пример #1
0
    // Use this for initialization
    void Start ()
    {
        velocity = Vector3.right;
        //MaxSpeed = 2.0f;

        mSteering = new SteeringBehaviors(this);
        Vector2 target = Forest.GetGlobalInstance().AnyLocation;//NavMesh2D.GetInstance().GetRandomPos();
        mSteering.SetTarget(target);

        mPath = AStar.GetInstance().FindPath(transform.position, target);
        mSteering.SetPath(mPath, false);

        smoke = Resources.Load("smoke") as GameObject;
        //INTERNAL
        //mSteering.SetFlag(Behavior.separation);
        //mSteering.SetFlag(Behavior.alignment);
        //mSteering.SetFlag(Behavior.cohesion);
        mSteering.SetFlag(Behavior.followPath);
        //mSteering.SetFlag(Behavior.wander2d);

        if (sfx == null)
            sfx = GameObject.Find("Audio/AudioSFX").GetComponent<AudioSource>();
    }