void Awake() { collider = this.GetComponentStrict <BoxCollider2D>(); buffs = new Buffable <MinionBuffs, Minion, IMinion>(this); this.sprite = this.GetComponentStrict <SpriteWrapper>(); collisionFilter = new ContactFilter2D(); var layerMask = new LayerMask(); layerMask.value |= 1 << 8; collisionFilter.SetLayerMask(layerMask); collisionFilter.useTriggers = true; attackChargeTimer = new Timer(stats.attackChargeTimeBase); attackCooldownTimer = new Timer(stats.AttackCooldown); deathTimer = new Timer(1); this.healthBar = Game.Resources.LoadPrefab <MinionHealthBar>("MinionHealthBar"); this.healthBar.gameObject.name = "MinionHealthBar"; this.healthBar.gameObject.transform.SetParent(gameObject.transform); this.waypoint = Game.Resources.LoadPrefab <MinionWaypoint>("Minions/Waypoint"); this.waypoint.Initialize(this); AddChild(Game.Resources.LoadPrefab <SpriteWrapper>("Sprites/ShadowSmall")); }
void Awake() { healthBar = transform.Find("Health").GetComponentStrict <SpriteWrapper>(); maxHealthBarScale = healthBar.Scale.x; curHealthPercent = 1; baseHealthX = healthBar.LocalPosition.x; }
void Awake() { friendlyTip = this.transform.Find("friendlyhptip").GetComponentStrict <SpriteWrapper>(); friendlyBar = this.transform.Find("friendlyhpbar").GetComponentStrict <SpriteWrapper>(); enemyTip = this.transform.Find("enemyhptip").GetComponentStrict <SpriteWrapper>(); enemyBar = this.transform.Find("enemyhpbar").GetComponentStrict <SpriteWrapper>(); friendlyText = this.transform.Find("friendlytext").GetComponentStrict <Text>(); enemyText = this.transform.Find("enemytext").GetComponentStrict <Text>(); }
protected override void OnAwake() { touchRegion = transform.Find("TouchRegion").gameObject.GetComponentStrict <BoxCollider2D>(); GameObject spellGameObject = transform.Find("SpellButton").gameObject; spellRegion = spellGameObject.GetComponentStrict <BoxCollider2D>(); spellButton = spellGameObject.transform.Find("spellbutton").GetComponentStrict <SpriteWrapper>(); cooldownText = spellGameObject.transform.Find("cooldowntext").GetComponentStrict <Text>(); moveGrid = transform.Find("MoveGrid").gameObject.GetComponentStrict <MoveGrid>(); waypoint = Game.Resources.LoadPrefab <Waypoint>("Waypoints/Waypoint"); }
protected override void OnConstruct() { renderer = this.GetComponentStrict <SpriteWrapper>(); enterTimer = new Timer(enterTransitionDuration); exitTimer = new Timer(exitTransitionDuration); if (persistDuration > 0) { persistTimer = new Timer(persistDuration); } state = EffectState.Entering; maxScale = new Vector2(transform.localScale.x, transform.localScale.y); }
void Awake() { circleCollider = this.GetComponentStrict <CircleCollider2D>(); center = this.transform.Find("Center").GetComponentStrict <CircleCollider2D>(); activeSprite = this.transform.Find("well").GetComponentStrict <SpriteWrapper>(); inactiveSprite = this.transform.Find("wellinactive").GetComponentStrict <SpriteWrapper>(); cooldownTimer = new Timer(cooldown); pushTimer = new Timer(pushDelay); SetState(WellState.Inactive); random = new UnityEngine.Random(); }
protected override void OnConstruct() { defaultSprite = this.AddChild(Game.Objects.CreatePrefab <SpriteWrapper>(defaultOrbSprite)); ClearOrbBehavior(); direction = startDirection; speed = startSpeed; collider = this.GetComponentStrict <CircleCollider2D>(); respawnTimer = new Timer(1); state = OrbState.Spawning; scoredSide = HeroSide.Bottom; sprites = new Dictionary <HeroSide, ISpriteWrapper>(); }
private void SetActiveSprite(ISpriteWrapper sprite) { if (sprite == currentSprite) { return; } if (currentSprite != null) { currentSprite.Visible = false; } sprite.Visible = true; currentSprite = sprite; }
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); } }
public void Initialize(IMinion owner) { this.owner = owner; healthBar = transform.Find("Health"); colorFrame = transform.Find("colorframe").GetComponentStrict <SpriteWrapper>(); if (owner.Owner.Side == HeroSide.Top) { colorFrame.Color = topColor; } else { colorFrame.Color = bottomColor; } levelText = transform.Find("leveltext").GetComponentStrict <Text>(); transform.localPosition = new Vector3(0, verticalOffset, 0); maxHealthBarScale = healthBar.localScale.x; curHealthPercent = 1; baseHealthX = healthBar.localPosition.x; }
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 <SpriteWrapper>(resetPosition: true); sprite.Color = new Color(0, 0, 0, 0); }
protected override void OnInitialize() { spriteWrapper = this.AddChild(Game.Objects.CreatePrefab <SpriteWrapper>(sprite)); }
protected override void OnConstruct() { blueSprite = transform.Find("bluedot").GetComponentStrict <SpriteWrapper>(); redSprite = transform.Find("reddot").GetComponentStrict <SpriteWrapper>(); neutralSprite = transform.Find("greydot").GetComponentStrict <SpriteWrapper>(); }
protected override void OnInitialize() { wrapper = this.AddChild(this.GetComponentInChildren <SpriteWrapper>(), resetPosition: false); wrapper.Visible = false; }