public Bomb() : base("Bomb") { this.Layer = (uint)CollisionLayer.Bombs; collider = new BoxCollider2D(Vector2.One); //collider.CollisionMode = CollisionMode.Collision; //collider.CollisionEnter += OnCollisionEnter; collider.CollisionMode = CollisionMode.Trigger; collider.TriggerExit += OnTriggerExit; colliders = new List <BoxCollider2D>(); AddComponent(collider); AddComponent(new BoxCollider2DRenderer(Vector4.Zero)); locations = new List <Vector2>(); renderer = new AnimationRenderer(FlyWeight.Get("Bomb"), 50, 50, 3, new int[] { 0, 1, 2, 1 }, 0.2f, true, false); AddComponent(renderer); #region FSM wait = new StateWait(this); explode = new StateExplode(this); explode.Next = wait; wait.Next = explode; wait.OnStateEnter(); AddComponent(new FSMUpdater(wait)); #endregion for (int i = 0; i < bigExplosion; i++) { Explosion toAdd = Pool <Explosion> .GetInstance(x => x.Active = false); explosionList.Add(toAdd); } // ChooseBomb(); }
private void Awake() { m_hActor = GetComponent<MadMaxActor>(); m_hRigidbody = GetComponent<Rigidbody>(); m_hLight = GetComponentInChildren<Light>(); m_hBulb = new LightBulb(this); inactive = new StateInactive(this); active = new StateActive(this); explode = new StateExplode(this); inactive.Active = active; active.Inactive = inactive; active.Explode = explode; explode.Inactive = inactive; inactive.OnStateEnter(); currentState = inactive; m_hBulb.Reset(); }