Exemple #1
0
        public static Entity CreateDestructible(string name, string prefabName, Vector3 worldPos, int maxHp)
        {
            var transform = new TransformModule(name, worldPos);
            var collision = new CollisionModule();
            var prop      = new PrefabModule(prefabName);
            var health    = new HealthModule(maxHp, maxHp);
            var destruct  = new DestructibleModule();

            return(new Entity(transform, collision, prop, health, destruct));
        }
Exemple #2
0
        public static Entity CreateBullet(string name, string prefabName, Vector3 worldPos, Vector3 velocity, Team team)
        {
            var transform = new TransformModule(name, worldPos);
            var collision = new CollisionModule();
            var prop      = new PrefabModule <ColorizableBehaviour>(prefabName);
            var bullet    = new BulletModule(team, velocity);

            prop.component.SetColor(team == Team.Red ? Color.red : Color.cyan);

            return(new Entity(transform, prop, collision, bullet));
        }
Exemple #3
0
        public static Entity CreatePlayerTank(string name, Vector3 worldPosition, int maxHp)
        {
            var agent       = new AgentModule(name, "AgentController", worldPosition);
            var userInput   = new UserAgentModule(Team.Blue);
            var collision   = new CollisionModule();
            var health      = new HealthModule(maxHp, maxHp);
            var pathfinding = new PathfindingModule(true);              // only used for debugging

            var tankModel = new PrefabModule <TankModelBehaviour>("TankModel");

            tankModel.component.SetColor(Color.green);
            tankModel.component.SetAgent(agent);
            tankModel.component.SetHealth(health);

            return(new Entity(health, agent, tankModel, collision, pathfinding, userInput));
        }
Exemple #4
0
        public static Entity CreateNpcTank(string name, Vector3 worldPosition, int maxHp, Team team)
        {
            var agent       = new AgentModule(name, "AgentController", worldPosition);
            var npc         = new NpcAgentModule(team);
            var collision   = new CollisionModule();
            var health      = new HealthModule(maxHp, maxHp);
            var pathfinding = new PathfindingModule();

            var tankModel = new PrefabModule <TankModelBehaviour>("TankModel");

            tankModel.component.SetColor(team == Team.Red ? Color.red : Color.cyan);
            tankModel.component.SetAgent(agent);
            tankModel.component.SetHealth(health);

            return(new Entity(health, agent, tankModel, collision, pathfinding, npc));
        }