// Enemy main nutrient getting absorbed and provide nutrient(child cell) to enemy main cell void Absorb() { Vector2 vectorToTarget = EMHelper.Instance().Position - (Vector2)transform.position; transform.position = Vector2.MoveTowards(transform.position, EMHelper.Instance().Position, (vectorToTarget.magnitude * fAbsorbTime + fAbsorbSpeed) * Time.deltaTime); transform.localScale = Vector3.one * (Vector2.Distance((Vector2)transform.position, EMHelper.Instance().Position)) / EMHelper.Instance().Radius * Random.Range(.5f, 1f); if (Vector2.Distance((Vector2)transform.position, EMHelper.Instance().Position) < .1f || transform.localScale.x < .1f) { if (Level_Manager.LevelID < 4) { EMController.Instance().AddFewNutrient((int)(Random.Range(2, 6) * EMDifficulty.Instance().CurrentDiff)); } else { EMController.Instance().AddFewChildCells((int)(Random.Range(2, 6) * EMDifficulty.Instance().CurrentDiff)); } if (!EMAnimation.Instance().IsExpanding) { EMAnimation.Instance().IsExpanding = true; } Destroy(this.gameObject); } }
public override void Enter() { transition = m_EMFSM.emTransition; helper = m_EMFSM.emHelper; // Turn blink animation on EMAnimation.Instance().CanBlink = true; // Reset availability to command mini cell to Landmine state if (!helper.CanAddLandmine) { helper.CanAddLandmine = true; } // Enable expand animation if (!EMAnimation.Instance().IsExpanding) { EMAnimation.Instance().IsExpanding = true; } // Reset transition availability transition.CanTransit = true; // Pause the transition for randomized time float fPauseTime = Random.Range((m_EMFSM.CurrentAggressiveness / 1.5f) / EMDifficulty.Instance().CurrentDiff, (m_EMFSM.CurrentAggressiveness) / EMDifficulty.Instance().CurrentDiff); helper.StartPauseTransition(fPauseTime); }
// Update width of enemy main cell void WidthUpdate() { // Get the width without considering expand animation if (width != EMAnimation.Instance().InitialScale.x *Mathf.Sqrt(Mathf.Sqrt(Mathf.Sqrt(m_EMFSM.Health)))) { width = EMAnimation.Instance().InitialScale.x *Mathf.Sqrt(Mathf.Sqrt(Mathf.Sqrt(m_EMFSM.Health))); } }
public override void Exit() { transition = m_EMFSM.emTransition; // Reset animation status if (EMAnimation.Instance().CanBlink) { EMAnimation.Instance().CanBlink = false; } // Reset availability to command mini cell to Landmine state if (!helper.CanAddLandmine) { helper.CanAddLandmine = true; } // Reset transition availability transition.CanTransit = true; }
public override void Exit() { transition = m_EMFSM.emTransition; controller = m_EMFSM.emController; helper = m_EMFSM.emHelper; // Reset animation status if (EMAnimation.Instance().CanBlink) { EMAnimation.Instance().CanBlink = false; } // Reset availability to command mini cell to Defend state if (!helper.CanAddDefend) { helper.CanAddDefend = true; } // Set status to not defending controller.bIsDefend = false; // Reset transition availability transition.CanTransit = true; }
public override void Enter() { transition = m_EMFSM.emTransition; helper = m_EMFSM.emHelper; // Turn blink animation on EMAnimation.Instance().CanBlink = true; // Reset availability to command mini cell to Attack state if (!helper.CanAddAttack) { helper.CanAddAttack = true; } // Reset transition availability transition.CanTransit = true; // Pause the transition for randomized time float fPauseTime = Random.Range(Mathf.Sqrt(m_EMFSM.CurrentAggressiveness) * 1.5f / EMDifficulty.Instance().CurrentDiff, Mathf.Sqrt(m_EMFSM.CurrentAggressiveness) * 2.5f / EMDifficulty.Instance().CurrentDiff); helper.StartPauseTransition(fPauseTime); }
public override void Enter() { transition = m_EMFSM.emTransition; controller = m_EMFSM.emController; helper = m_EMFSM.emHelper; // Turn blink animation on EMAnimation.Instance().CanBlink = true; // Reset availability to command mini cell to Defend state if (!helper.CanAddDefend) { helper.CanAddDefend = true; } // Set status to defending controller.bIsDefend = true; // Reset transition availability transition.CanTransit = true; // Pause the transition for randomized time float fPauseTime = Random.Range(Mathf.Sqrt(Mathf.Sqrt((float)PlayerChildFSM.GetActiveChildCount() + 4f)) * 2f, Mathf.Sqrt((float)PlayerChildFSM.GetActiveChildCount() + 4f) * 2f); helper.StartPauseTransition(fPauseTime); }