void UpdateDirect() { direcr = Mathf.Sign(TargetManager.PlayerController.transform.position.x - pysicItem.Position.x); cooldownItem = CooldownManager.AddCooldown(1, null, UpdateDirect); }
public void ReSpawnFromDead() { gameObject.SetActive(false); CooldownManager.AddCooldown(3, null, () => { pysicItem.AddVelocity(-pysicItem.velocity); transform.position = new Vector3(spawnPos.x * TileDataProvider.TileSize, spawnPos.y * TileDataProvider.TileSize + 3, transform.position.z); pysicItem.SetPosition(transform.position); SetHP(100); gameObject.SetActive(true); }); }
public void Init(float dutarion, float maxColorSize, float gravityY, Vector2 startVelocity) { this.maxColorSize = maxColorSize; var physicItem = MonoBehaviourPhysicItem.GetPhysicItem(); physicItem.SetGravity(new Vector2(0, gravityY)); physicItem.SetPosition(transform.position); physicItem.AddVelocity(-physicItem.velocity); physicItem.AddVelocity(startVelocity); physicItem.IsCollisionTerrain = false; physicItem.IsReactExplosion = false; cooldown = CooldownManager.AddCooldown(dutarion, CooldownUpdate, UnSpawn, 0, Time.fixedDeltaTime); }
public void Init(Color color, string text) { label.color = color; label.effectColor = Color.black; label.text = text; tweenAlpha.duration = 1; tweenScale.duration = 1; tweenScale.ResetToBeginning(); tweenAlpha.ResetToBeginning(); tweenScale.Play(); tweenAlpha.Play(); cooldown = CooldownManager.AddCooldown(tweenAlpha.duration, null, UnSpawn, 0, Time.fixedDeltaTime); }
void OnCollision(IPhysicItem item) { var bagItem = item.View.GetComponent <IPoolBagItem>(); if (bagItem != null) { model.GetBag().AddBagItem(bagItem.GetBagItem()); IgoPoolManager.Unspawn(item.View.gameObject); return; } var ai = item.View.GetComponent <AiController>(); if (ai != null) { if (Time.time - oldAiCollisionT > 0.5f) { oldAiCollisionT = Time.time; var direcr = Mathf.Sign(transform.position.x - ai.transform.position.x); var vect = transform.position - ai.transform.position; pysicItem.AddVelocity(-pysicItem.velocity); pysicItem.AddVelocity(vect.normalized * 14);//new Vector2(direcr*7, 8)); ai.GetComponent <UnitViewReciver>().PlayAttck(); Damage(5); TweenAlpha(0.2f, true); CooldownManager.AddCooldown(0.5f, null, () => { TweenAlpha(0.2f, false); }); } ; // ai.behaviour.Jamp(); return; } }
public override void OnSpawn() { this.Inject(); MainParticle.Play(); OtherParticle.Play(); tweenScale.ResetToBeginning(); tweenScale.enabled = true; tweenScale.Play(); CooldownManager.AddCooldown(MainParticle.duration, null, UnSpawn, 0, Time.fixedDeltaTime); //GameObjectPoolManager.Spawn<LightBoomEffect>(transform.position, Quaternion.identity); for (int i = 0; i < 5; i++) { var point = IgoPoolManager.Spawn <LightPointEffect>(transform.position, Quaternion.identity) .GetComponent <LightPointEffect>(); point.Init(5, Random.Range(0.2f, 0.7f), Random.Range(-0.4f, -0.1f), new Vector2(Random.Range(-2f, 2), Random.Range(-2f, 2))); } }
public void Init(string name, int count) { Count = count; Name = name; if (CurrentVisible.ContainsKey(name)) { Count += CurrentVisible[name].Count; CurrentVisible[name].ForceUnSpawn(); } foreach (var lbl in CurrentVisible) { if (lbl.Key != name) { if (lbl.Value.transform.position.y - transform.position.y < 25) { lbl.Value.transform.position = lbl.Value.transform.position + Vector3.up * 25; } } } CurrentVisible[name] = this; label.color = Color.white; label.effectColor = Color.black; label.text = string.Format("{0} :({1})", name, Count); tweenAlpha.duration = 2; tweenScale.duration = 2; tweenScale.ResetToBeginning(); tweenAlpha.ResetToBeginning(); tweenScale.Play(); tweenAlpha.Play(); cooldown = CooldownManager.AddCooldown(tweenAlpha.duration, null, UnSpawn, 0, Time.fixedDeltaTime); }
public override void Spawn(EntityController origin, int index, params Muzzle[] muzzles) { ItemStack itemStack = m_ItemStacks[index]; ActiveGem activeGem = itemStack.Item as ActiveGem; if (!activeGem) { return; } if (HasCooldown(origin, index)) { return; } Entity entity = new Entity(); entity.CopyFrom(CalculateEntity(index)); CooldownManager.AddCooldown(itemStack, entity.GetStat("core.modtypes.skills.cooldown").Calculated); CooldownManager.AddCooldown(origin, entity.GetStat("core.modtypes.skills.casttime").Calculated); //Entity statsWithout = new Entity(); //statsWithout.CopyFrom(EntityStats.Entity); //statsWithout.EntityBehaviour = origin.SpaceShip; //CooldownManager.AddCooldown(m_EnemyController.SpaceShip.Entity,1.0f); activeGem.Activate(origin, CalculateEntity(index), itemStack.PowerLevel + origin.SpaceShip.Entity.GetStat("core.modtypes.utility.level").Calculated / 5, 0, muzzles); }
public override void OnSpawn() { this.Inject(); CooldownManager.AddCooldown(anim.length, null, UnSpawn, 0, Time.fixedDeltaTime); }
public virtual void OnSpawn() { this.Inject(); CooldownManager.AddCooldown(MainParticle.duration, null, UnSpawn, 0, Time.fixedDeltaTime); }
public void OnInject() { CooldownManager.AddCooldown(cooldown, null, Explosion); // LightRendererOld.AddPoint(lightPoint); }
public void Update() { var dir = new Vector2(); var pos = pysicItem.Position; switch (State) { case MinerState.idleReturn: if (cooldownIdleReturn == null) { cooldownIdleReturn = CooldownManager.AddCooldown(1, null, () => { CooldownManager.RemoveCooldown(cooldownIdleReturn); cooldownIdleReturn = null; direcr = 1; State = MinerState.runMine; view.StopTruck(); }); } break; case MinerState.idleMine: if (cooldownIdleMine == null) { cooldownIdleMine = CooldownManager.AddCooldown(1, null, () => { direcr = -1; State = MinerState.runReturn; CooldownManager.RemoveCooldown(cooldownIdleMine); cooldownIdleMine = null; view.StopKirka(); view.PlayTruck(); }); view.PlayKirka(); } break; case MinerState.runMine: dir = new Vector2(speed * direcr, 0); pysicItem.AddVelocity(dir); if (pos.x > maxPos.x && direcr != -1) { pysicItem.SetVelocity(new Vector2()); State = MinerState.idleMine; } break; case MinerState.runReturn: dir = new Vector2(speed * direcr, 0); pysicItem.AddVelocity(dir); if (pos.x < minPos.x && direcr != 1) { pysicItem.SetVelocity(new Vector2()); pysicItem.SetPosition(new Vector2(minPos.x, pysicItem.Position.y)); // direcr = 1; speed = UnityEngine.Random.Range(0.1f, 4.5f); State = MinerState.idleReturn; } break; } }