protected override void OnConstruct() { stateMachine = new EntityStateMachine <BeeState, Bee>(this); stateMachine.RegisterInitialState(BeeState.Idle, new IdleState()); stateMachine.RegisterState(BeeState.Moving, new MovingState()); stateMachine.RegisterState(BeeState.Hit, new HitState()); }
protected override void OnConstruct() { waypoint = new Vector2(-1, -1); queuedWaypoint = new Vector2(-1, -1); stateMachine = new EntityStateMachine <HeroState, Hero>(this); stateMachine.RegisterInitialState(HeroState.Standing, new StandingState()); stateMachine.RegisterState(HeroState.Running, new RunningState()); boxCollider = this.GetComponentStrict <BoxCollider2D>(); OrbBehavior = this.GetComponentStrict <OrbBehavior>(); buffs = new Buffable <HeroBuffs, Hero, IHero>(this); collisionFilter = new ContactFilter2D(); var layerMask = new LayerMask(); layerMask.value |= 1 << 8; collisionFilter.SetLayerMask(layerMask); this.stats.Initialize(); regenTimer = new Timer(1); isSpellOnCooldown = true; this.paddle = AddChild(Game.Resources.LoadPrefab <Paddle>("Heroes/Paddle"), resetPosition: true); audioSource = this.GetComponentStrict <AudioSource>(); this.spell = AddChild(Game.Objects.CreatePrefab(this.spell)); spellCooldownTimer = new Timer(this.spell.cooldown); }
protected override void OnInitialize() { sprite = AddChild(this.GetComponentStrict <SpriteWrapper>(), resetPosition: true); stateMachine = new EntityStateMachine <PaddleState, Paddle>(this); stateMachine.RegisterInitialState(PaddleState.Normal, new NormalState()); stateMachine.RegisterState(PaddleState.Cooldown, new CooldownState()); stateMachine.RegisterState(PaddleState.Aiming, new AimingState()); if (Hero.Side == HeroSide.Top) { sprite.Scale = new Vector2(1, -1); } if (Hero.Side == HeroSide.Top) { transform.localPosition = new Vector3(0, -1f); } else { transform.localPosition = new Vector3(0, 1f); } }
protected override void OnInitialize() { sprite = AddChild(this.GetComponentStrict <SpriteWrapper>(), resetPosition: true); sprite.Color = this.defaultColor; stateMachine = new EntityStateMachine <AimRegionState, AimRegion>(this); stateMachine.RegisterInitialState(AimRegionState.Normal, new NormalState()); stateMachine.RegisterState(AimRegionState.Cooldown, new CooldownState()); if (paddle.Hero.Side == HeroSide.Top) { transform.localPosition = new Vector3(0, -6); } else { transform.localPosition = new Vector3(0, 6); } }