Ejemplo n.º 1
0
    private void createActorGameObjectPool()
    {
        for (int i = 0; i < _minActiveActors; i++)
        {
            Actor_Entity actor = createActorEntity("Pooled_Actor_" + i);
            activeActors.Add(actor.actorController);
            actor.GO.transform.parent = _activeActorsGroup.transform;

            //activeActors.Add(new GameObject("Pooled_Actor").AddComponent<Actor_Controller>());
            //activeActors[i].transform.parent = _activeActorsGroup.transform;
            //GameObject debugActorTMP = Instantiate((GameObject)Resources.Load("Debug/Debug_Actor"));
            //debugActorTMP.transform.SetParent(activeActors[i].gameObject.transform);
#if false
            //HACK: the only hacky way to get a cube mesh :(
            GameObject tmp  = GameObject.CreatePrimitive(PrimitiveType.Cube);
            Mesh       mesh = tmp.GetComponent <MeshFilter>().sharedMesh;
            Material   mat  = tmp.GetComponent <MeshRenderer>().material;
            _activeActorsPool[i]._parentGO.AddComponent <MeshFilter>().sharedMesh = mesh;
            _activeActorsPool[i]._parentGO.AddComponent <MeshRenderer>().material = mat;
            GameObject.Destroy(tmp);
#endif

            activeActors[i].resetActor();
        }
    }
Ejemplo n.º 2
0
    public Actor_Entity createActorEntity(string name)
    {
        Actor_Entity actor = new Actor_Entity();

        actor.GO                      = Instantiate((GameObject)Resources.Load("Debug/Debug_Actor"));
        actor.GO.name                 = name;
        actor.actorController         = actor.GO.AddComponent <Actor_Controller>();
        actor.actorMovementController = actor.GO.AddComponent <Actor_Movement_Controller>();
        actor.actorController.actorMovementController = actor.actorMovementController;
        return(actor);
    }
Ejemplo n.º 3
0
    private Player_Entity makePlayer(string name)
    {
        Actor_Data    data   = new Actor_Data(); //creates new random Actor_Data
        Actor_Entity  actor  = Actor_Manager.singleton.createActorEntity(name);
        Player_Entity player = new Player_Entity(actor);

        player.playerController = player.GO.AddComponent <Player_Controller>();

        player.actorController.actorData                  = data;
        player.actorController.actorData.name             = name;
        player.actorController.actorData.breedData.gender = Actor_Gender.male;
        player.actorController.actorData.ageInSecondsMax  = ulong.MaxValue - 1;
        player.actorController.actorData.essential        = true;

        //GameObject debugActorTMP = Instantiate((GameObject)Resources.Load("Debug/Debug_Actor"));
        //debugActorTMP.transform.SetParent(player.playerGO.gameObject.transform);

        player.GO.transform.position = new Vector3(Random.Range(10.0f, 20.0f), 0.0f, Random.Range(10.0f, 20.0f));

        DontDestroyOnLoad(player.GO);

        return(player);
    }
Ejemplo n.º 4
0
 public Player_Entity(Actor_Entity actor)
 {
     GO = actor.GO;
     actorController         = actor.actorController;
     actorMovementController = actor.actorMovementController;
 }