public new void SystemUpdate() { var poolManager = PoolManager.Instance(); var cooldownAccessor = TAccessor <CooldownModule> .Instance(); foreach (var module in cooldownAccessor.GetAllModules()) { var entity = module.gameObject; if (module != null) { if (module.ResetCooldown <= 0) { Debug.Log("Pan !"); module.ResetCooldown = module.Cooldown; PoolableObject bullet = poolManager.GetPooledObject(objectType.bullet); // Initialize and set active all instancied bullet in the bullet pool if (bullet != null) { bullet.Init(entity.transform.position); _objects.Add(bullet); } } else { module.ResetCooldown -= Time.deltaTime; } } } }
// Update is called once per frame private void Start() { gunComponent = new GunModule(this.isFiring, this.bullet, this.firePoint, this.bulletSpeed, this.shotInterval, this.shotCounter); Modules = new List <ScriptableObject>(); Modules.Add(gunComponent); TAccessor <GunModule> .Instance().Add(gunComponent); }
public void SystemUpdate() { double angle = 90; TAccessor <CircleModule> movAccessor = TAccessor <CircleModule> .Instance(); foreach (var module in movAccessor.GetAllModule()) { GameObject myEntity = module.gameObject; angle *= Math.PI / 180; float xO = module.pwayer.position.x; float zO = module.pwayer.position.z; float xM = myEntity.transform.position.x - xO; float zM = myEntity.transform.position.z - zO; float X = (float)((xM * Math.Cos(angle)) + (zM * Math.Sin(angle)) + xO); float Z = (float)((-xM * Math.Sin(angle)) + (zM * Math.Cos(angle)) + zO); Debug.Log("X : " + X); Debug.Log("Z : " + Z + " le z"); Debug.Log("Angle : " + angle); Vector3 move = new Vector3(X, 0, Z) * Time.deltaTime; myEntity.transform.Translate(move); } }
public override void SystemUpdate() { foreach (var module in TAccessor <FollowTarget> .Instance().GetModules()) { if (!module.target) { module.target = GameObject.Find("Pacman").transform; } // 10 = moveSpeed transform.LookAt(module.target); transform.position += transform.rotation * Vector3.forward * module.moveSpeed * Time.deltaTime; if (Vector3.Distance(transform.position, module.target.transform.position) < .5f) { module.target.gameObject.GetComponent <EdibleModule>().deleteModule(); module.target.gameObject.GetComponent <TargetEdible>().deleteModule(); Destroy(module.target.gameObject); Vector3 position = new Vector3(Random.Range(-25f, 25f), 0.5f, Random.Range(-25f, 25f)); GameObject obj = Instantiate(module.pacman, position, Quaternion.identity); module.target = obj.transform; } } }
public void SystemUpdate() { var poolManager = PoolManager.Instance(); var playerShotAccessor = TAccessor <PlayerShotModule> .Instance(); foreach (var module in playerShotAccessor.GetAllModules()) { var entity = module.gameObject; var currentMod = playerShotAccessor.TryGetModule(entity); if (currentMod != null) { if (Input.GetKeyDown(currentMod.Key)) { PoolableObject bullet = poolManager.GetPooledObject(objectType.bullet); // Initialize and set active all instancied bullet in the bullet pool if (bullet != null) { bullet.Init(entity.transform.position); _objects.Add(bullet); } } } } }
public void SystemUpdate() { TAccessor <ShootModule> myModuleAccessor = TAccessor <ShootModule> .Instance(); foreach (var module in myModuleAccessor.DisplayListT()) { } }
void Start() { shootComponent = new ShootModule(bullet, firePoint, speed, egg); Modules = new List <ScriptableObject>(); Modules.Add(shootComponent); TAccessor <ShootModule> .Instance().Add(shootComponent); }
private void Start() { spawnComponent = new SpawnModule(haut, gauche, droite, farmerHaut, farmerVertical); Modules = new List <ScriptableObject>(); Modules.Add(spawnComponent); TAccessor <SpawnModule> .Instance().Add(spawnComponent); }
private void Start() { moveComponent = new MoveModule(speed.x * Input.GetAxis("Horizontal"), speed.y * Input.GetAxis("Vertical"), this.gameObject.transform); Modules = new List <ScriptableObject>(); Modules.Add(moveComponent); TAccessor <MoveModule> .Instance().Add(moveComponent); }
public static TAccessor <T> Instance() { if (_instance == null) { _instance = new TAccessor <T>(); } return(_instance); }
static public TAccessor <T> Instance() { if (_singleton == null) { _singleton = new TAccessor <T>(); } return(_singleton); }
void Start() { shootFarmerComponent = new ShootFarmerModule(fourche, firePoint, speed); Modules = new List <ScriptableObject>(); Modules.Add(shootFarmerComponent); TAccessor <ShootFarmerModule> .Instance().Add(shootFarmerComponent); }
void Start() { healthComponent = new HealthModule(health, currentHealth, maxHealth); Modules = new List <ScriptableObject>(); Modules.Add(healthComponent); TAccessor <HealthModule> .Instance().Add(healthComponent); }
private void Start() { Vector3 direction = shootDown == false ? Vector3.up : Vector3.down; bulletComponent = new BulletModule(speed, bullet, direction); Modules = new List <ScriptableObject>(); Modules.Add(bulletComponent); TAccessor <BulletModule> .Instance().Add(bulletComponent); }
public void SystemUpdate() { TAccessor <BulletModule> moduleAccessor = TAccessor <BulletModule> .Instance(); foreach (var module in moduleAccessor.DisplayListT()) { module.bulletTransform.position += module.direction * (Time.deltaTime * module.speed); } }
public void SystemUpdate() { TAccessor <MovementModule> myModuleAccessor = TAccessor <MovementModule> .Instance(); foreach (var module in myModuleAccessor.DisplayListT()) { module.playerTransform.position += new Vector3(module.speedX, module.speedY) * Time.deltaTime; } }
public new void SystemUpdate() { var speedAccessor = TAccessor <SpeedModule> .Instance(); foreach (var module in speedAccessor.GetAllModules()) { Debug.Log("J'AVANCErrrr"); var entity = module.gameObject; entity.transform.position -= entity.transform.forward * (Time.deltaTime * module.Speed); } }
public void SystemUpdate() { TAccessor <BulletMov> movAccessor = TAccessor <BulletMov> .Instance(); foreach (var module in movAccessor.GetAllModule()) { GameObject myEntity = module.gameObject; Vector3 move = new Vector3(0, 0, module.Speed) * Time.deltaTime; myEntity.transform.Translate(move); } }
private void Start() { //moveComponent = new MoveModule(speed.x * Input.GetAxis("Horizontal"), speed.y * Input.GetAxis("Vertical"), this.gameObject.transform); moveComponent = new MoveModule(speed.x, speed.y, this.gameObject.transform); Modules = new List <ScriptableObject>(); Modules.Add(moveComponent); TAccessor <MoveModule> .Instance().Add(moveComponent); frequency = 2.0F; magnitude = Random.Range(0.005F, 0.008F); speedFarmer = 4.0F; }
public override void SystemUpdate() { foreach (var module in TAccessor <TargetEdible> .Instance().GetModules()) { if (!module.fruitTarget) { module.fruitTarget = GameObject.FindWithTag("Fruit").transform; } transform.LookAt(module.fruitTarget); transform.position += transform.rotation * Vector3.forward * 15 * Time.deltaTime; } }
public void SystemUpdate() { TAccessor <BulletModule> BulAccessor = TAccessor <BulletModule> .Instance(); foreach (var module in BulAccessor.GetAllModule()) { if (Input.GetKeyDown("space")) { GameObject myEntity = module.gameObject; Vector3 V = new Vector3(myEntity.transform.position.x, myEntity.transform.position.y, myEntity.transform.position.z + 0.5f); var tempBullet = UnityEngine.Object.Instantiate(module.Bullet, V, myEntity.transform.rotation); UnityEngine.Object.Destroy(tempBullet, 5); } } }
public void SystemUpdate() { TAccessor <MovementModule> movAccessor = TAccessor <MovementModule> .Instance(); foreach (var module in movAccessor.GetAllModule()) //gère les mouvement appliquer par le joueur pour manipuller une a plusieur entité a la foix { GameObject myEntity = module.gameObject; float inputX = Input.GetAxis("Horizontal"); float inputY = Input.GetAxis("Vertical"); Vector3 move = new Vector3(module.Speed * inputX, 0, module.Speed * inputY) * Time.deltaTime; myEntity.transform.Translate(move); } }
public void SystemUpdate() { var zigzagAccessor = TAccessor <ZigZagModule> .Instance(); foreach (var module in zigzagAccessor.GetAllModules()) { var entity = module.gameObject; var currentMod = zigzagAccessor.TryGetModule(entity); if (currentMod != null) { entity.transform.position -= entity.transform.forward * Time.deltaTime * currentMod.Speed + entity.transform.right * Mathf.Sin(Time.time * currentMod.Frequency) * currentMod.Magnitude; } } }
public void SystemUpdate() { var playerAccessor = TAccessor <PlayerSpeedModule> .Instance(); foreach (var module in playerAccessor.GetAllModules()) { var entity = module.gameObject; var currentMod = playerAccessor.TryGetModule(entity); if (currentMod != null) { Vector3 _move = new Vector3(Input.GetAxis("Horizontal"), 0f, Input.GetAxis("Vertical")); entity.transform.position += _move * Time.deltaTime * currentMod.PlayerSpeed; } } }
public override void SystemUpdate() { for (int i = 0; i < TAccessor <EatEdibleScript> .Instance().GetModules().Count; i++) { TargetEdible targetEd = TAccessor <TargetEdible> .Instance().GetModule(i); Pacman entityPacman = TAccessor <Pacman> .Instance().GetModule(i); if (Vector3.Distance(targetEd.fruitTarget.position, entityPacman.pacman.position) < .5f) { // Le pacman mange un fruit Destroy(targetEd.fruitTarget.gameObject); } } }
public void SystemUpdate() { TAccessor <GunModule> moduleAccessor = TAccessor <GunModule> .Instance(); foreach (var module in moduleAccessor.DisplayListT()) { if (module.isFiring) { module.shotCounter -= Time.deltaTime; if (module.shotCounter < 0.5f) { module.shotCounter = module.shotInterval; BulletScript newBullet = MonoBehaviour.Instantiate(module.bullet, module.firePoint.position, module.firePoint.rotation); newBullet.speed = module.bulletSpeed; } } } }
public void SystemUpdate() { TAccessor <LinearDeplacement> accessor = TAccessor <LinearDeplacement> .Instance(); foreach (LinearDeplacement module in accessor.GetAllModules()) { if (module.gameObject.CompareTag("Player")) { PlayerMouvements(module); } else { module.gameObject.transform.Translate(module.speed * Time.deltaTime * module.left); module.gameObject.transform.Translate(module.speed * Time.deltaTime * module.right); module.gameObject.transform.Translate(module.speed * Time.deltaTime * module.forward); module.gameObject.transform.Translate(module.speed * Time.deltaTime * module.back); } } }
public void SystemUpdate() { var poolManager = PoolManager.Instance(); var spawnAccessor = TAccessor <SpawnModule> .Instance(); foreach (var module in spawnAccessor.GetAllModules()) { if (_timeRemaining > 0) { _timeRemaining -= Time.deltaTime; } else { _timeRemaining = 20; PoolableObject ennemy = poolManager.GetPooledObject(objectType.ennemy); if (ennemy != null) { ennemy.Init(new Vector3(Random.Range(-5.0f, 5.0f), 0, Random.Range(-5.0f, 5.0f))); _objects.Add(ennemy); } } } }
void Start() { TAccessor <EdibleModule> .Instance().AddModule(this); }
public void deleteModule() { TAccessor <EdibleModule> .Instance().RemoveModule(this); }