public void CreateBrother() { var brother = WindowFactory.Clone().transform as RectTransform; brother.SetParent(transform.parent, false); brother.offsetMin = (transform as RectTransform).offsetMin + new Vector2(80, -80f); brother.offsetMax = (transform as RectTransform).offsetMax + new Vector2(80, -80f); _parent.PushState(brother.GetComponent <StackStateMachine>()); brother.GetComponent <Window>()._parent = _parent; }
void Start() { m_stateMachine = new StackStateMachine <Dog>(); m_stateMachine.AddState("Follow", new FollowState <Dog>(this)); m_stateMachine.AddState("Jump", new JumpState <Dog>(this)); m_stateMachine.AddState("Drop", new DropState <Dog>(this)); m_stateMachine.PushState("Follow"); m_animator = GetComponent <Animator>(); m_rigidBody2D = GetComponent <Rigidbody2D>(); m_startScale = transform.localScale; m_currentScale = m_startScale; }
void Start() { m_stateMachine = new StackStateMachine <Enemy>(); m_stateMachine.AddState("Patrol", new PatrolState <Enemy>(this)); m_stateMachine.AddState("Attack", new AttackState <Enemy>(this)); m_stateMachine.AddState("Seek", new SeekState <Enemy>(this)); m_stateMachine.AddState("Jump", new JumpState <Enemy>(this)); m_stateMachine.AddState("Drop", new DropState <Enemy>(this)); m_stateMachine.PushState("Patrol"); m_rigidbody2D = GetComponent <Rigidbody2D>(); m_animator = GetComponent <Animator>(); m_spriteRenderer = GetComponent <SpriteRenderer>(); m_startScale = transform.localScale; m_currentScale = m_startScale; m_attackReset = Random.Range(m_attackCooldown, m_attackCooldown + 0.25f); }
void Start() { m_healthBar = GetComponentInChildren <HealthBar>(); m_animator = GetComponent <Animator>(); m_perception = GetComponentInChildren <PerceptionSphere>(); m_stateMachine = new StackStateMachine <AI>(); m_rigidbody2D = GetComponent <Rigidbody2D>(); m_weapon = GetComponentInChildren <Weapon>(); m_renderer = GetComponent <SpriteRenderer>(); m_weapon.maxDamage = 25; m_weapon.minDamage = 10; m_weapon.m_targetTag = "Player"; m_stateMachine.AddState("ALERT", new AlertState <AI>(this)); m_stateMachine.AddState("ATTACK", new SwooshyState <AI>(this)); m_stateMachine.AddState("PATROL", new WanderState <AI>(this)); m_stateMachine.PushState("PATROL"); }