void OnEnable() { rigid = GetComponent <Rigidbody>(); contact = GetComponent <GroundContact>(); area = FindObjectOfType <FightArea>(); manager = FindObjectOfType <FightManager>(); }
public GameApplication(GameConfig game_cfg, GameWindow gameWindow) { Config = game_cfg; _gameWindow = gameWindow; Width = Config.WindowConfig.ScreenWidth; Height = Config.WindowConfig.ScreenHeight; _timer = new GameTimer(); world1 = new ParticleWorld(300, 16); respawn = new ParticleRespawn(1, 3); //radialWind = new ParticleWind(new ge.Vec3(100.0f, 100.0f, 0.0f), 10000.0f, 10.0f); //radialWind2 = new ParticleWind(new ge.Vec3(500.0f, 300.0f, 0.0f), 6000.0f, 15.0f); particleArray = new Particle[particleCount + freeParticles]; for (int i = 0; i < (particleCount + freeParticles); ++i) { particleArray[i] = new Particle(); } particleGravityArray = new ParticleGravity[(particleCount + freeParticles)]; //particleGravityArray2 = new ParticleGravity[(particleCount + freeParticles)]; for (int i = 0; i < (particleCount + freeParticles); i++) { world1.getParticles().Add(particleArray[i]); } groundContactGenerator = new GroundContact(); groundContactGenerator.init(world1.getParticles()); particleRods = new ParticleRod[cablesCount]; sphereContactGenerator = new SphereContact(); sphereContactGenerator.init(world1.getParticles()); world1.getContactGenerators().Add(groundContactGenerator); world1.getContactGenerators().Add(sphereContactGenerator); }