Example #1
0
        public void InitPhysicsManager()
        {
            //find all colliders in the scene A$AP
            boxList = GameObject.FindGameObjectsWithTag("Ground");
            for (int i = 0; i < boxList.Length; i++)
            {
                floorBoundingBoxes.Add(boxList[i].GetComponent <AABB>());
            }
            boxList = null;
            boxList = GameObject.FindGameObjectsWithTag("Entity");
            for (int i = 0; i < boxList.Length; i++)
            {
                entityBoundingBoxes.Add(boxList[i].GetComponent <AABB>());
            }
            // add player collider
            entityBoundingBoxes.Add(GameObject.FindGameObjectWithTag("Player").GetComponent <AABB>());

            boxList = null;
            boxList = GameObject.FindGameObjectsWithTag("Boundary");
            for (int i = 0; i < boxList.Length; i++)
            {
                boundaryBoundingBoxes.Add(boxList[i].GetComponent <AABB>());
            }
            // initialise collision data
            colPair = new CollisionPair();

            // initialise all rigidbodies in scene
            InitRigidbodiesInScene();

            // initialise nav graph
            grid = GetComponent <NavGraph>();
            grid.InitGraph();

            chargeRate = 0;
            chargeDmg  = 0;

            dPath = new List <Vector2>();
        }