Inheritance: RandomPath
Ejemplo n.º 1
0
    /** Starts a path specified by PathTypesDemo::activeDemo */
    public void DemoPath()
    {
        Path p = null;

        if (activeDemo == 0) {
            p = new Path (start.position,end.position, OnPathComplete);
        } else if (activeDemo == 1) {
            MultiTargetPath mp = new MultiTargetPath (multipoints.ToArray (), end.position, null, OnPathComplete);
            p = mp;
        } else if (activeDemo == 2) {
            RandomPath rp = new RandomPath (start.position,searchLength, OnPathComplete);
            rp.spread = spread;
            rp.aimStrength = aimStrength;
            rp.aim = end.position;
            rp.replaceChance = replaceChance;

            p = rp;
        } else if (activeDemo == 3) {
            FleePath fp = new FleePath (start.position, end.position, searchLength, OnPathComplete);
            fp.fleeStrength = aimStrength;
            fp.replaceChance = replaceChance;
            fp.spread = spread;

            p = fp;
        } else if (activeDemo == 4) {
            ConstantPath constPath = new ConstantPath (start.position, searchLength, OnPathComplete);

            p = constPath;
        }

        if (p != null) AstarPath.StartPath (p);
    }
Ejemplo n.º 2
0
        public static FleePath Construct(Vector3 start, Vector3 avoid, int searchLength, OnPathDelegate callback = null)
        {
            FleePath path = PathPool <FleePath> .GetPath();

            path.Setup(start, avoid, searchLength, callback);
            return(path);
        }
Ejemplo n.º 3
0
        public static FleePath Construct(Vector3 start, Vector3 avoid, int searchLength, [Optional, DefaultParameterValue(null)] OnPathDelegate callback)
        {
            FleePath path = PathPool.GetPath <FleePath>();

            path.Setup(start, avoid, searchLength, callback);
            return(path);
        }