Exemple #1
0
    public void InstantiateBySpawner(Nav2D polyNav, Transform parentTransform)
    {
        SetAgentNav(polyNav);
        transform.SetParent(parentTransform);

        name = Constants.NPC_NAME + npcName;
        SetSpawned(true);
    }
    public override void OnInspectorGUI()
    {
        Nav2D mapGen = (Nav2D)target;

        if (DrawDefaultInspector())
        {
            //mapGen.generateNavMesh();
        }

        // if (GUILayout.Button("Generate"))
        // {
        //     mapGen.GenerateNavMesh();
        // }
    }
        //public ParticleSystem particlesSystemParent;

        void Start()
        {
            Nav2D nav2D = GameObject.FindWithTag("MainNavGrid").GetComponent <Nav2D>();

            if (spell != null)
            {
                if (spell.travelCost > 0)
                {
                    // apply travel cost to nav2d nodes under circle target
                    affectedNodes = nav2D.GetNodesInCircle(transform.position, radius + safeDistance);
                    //
                }
            }

            BaseStart();
            setRadius(radius);
        }
Exemple #4
0
 //some initializing
 void Awake()
 {
     _current = this;
     masterCollider.enabled = false;
     GenerateMap(true);
 }
Exemple #5
0
 private void Awake()
 {
     Nav2D           = new Nav2D(ToVec2(_LeftBottomMapCorner), ToVec2(_RightUpperMapCorner), _AgentRadius, _Accuracy);
     Nav2D.DebugLog += Debug.Log;
 }
Exemple #6
0
 public void SetAgentNav(Nav2D nav)
 {
     agent.polyNav = nav;
 }