private void Awake() { IdleState = new IdleState(this); AttackState = new AttackState(this); JumpState = new JumpState(this); CurrentState = IdleState; mobColor = GetComponent <MeshRenderer>(); rigidBody = GetComponent <Rigidbody>(); animator = GetComponent <Animator>(); Attack = new StandardAttack(this); Health = 10; }
public override void SpawnMe(Player a_player, Map a_map, PathFinder a_pathfinder) { //abilities //build extractor m_actionbox[0, 2] = new ObjectAction("Extractor", "Cost: 15\nRequires a Spark of Life.\nExtractor will produce new Cubes until it out of resources", Microsoft.Xna.Framework.Input.Keys.E, ObjectAction.Type.Target, BuildExtractorFunction); m_actionbox[0, 2].SetBuildingTag(a_player.m_thingsAssets.m_extractor.m_size, true, a_player.m_thingsAssets.m_extractor.m_price); //Build igloo m_actionbox[1, 2] = new ObjectAction("Igloo", "Cost: 2\nBuilds an Igloo to increase your supply by 8", Microsoft.Xna.Framework.Input.Keys.G, ObjectAction.Type.Target, BuildIglooFunction); m_actionbox[1, 2].SetBuildingTag(a_player.m_thingsAssets.m_igloo.m_size, false, a_player.m_thingsAssets.m_igloo.m_price); //Build barracks m_actionbox[2, 2] = new ObjectAction("Barrack", "Costs: 5\nBuilds a barrack to produce more potent units", Microsoft.Xna.Framework.Input.Keys.B, ObjectAction.Type.Target, BuildBarrackFunction); m_actionbox[2, 2].SetBuildingTag(a_player.m_thingsAssets.m_barrack.m_size, false, a_player.m_thingsAssets.m_barrack.m_price); m_attackBehavior = new StandardAttack(this, a_player.m_thingsAssets.m_cube.m_attackBehavior.GetAttackRate() , a_player.m_thingsAssets.m_cube.m_attackBehavior.GetDamage() , a_player.m_thingsAssets.m_cube.m_attackBehavior.GetAttackRange()); //Sets the cubes moveBehavior!! m_moveBehavior = a_player.m_thingsAssets.m_cube.m_moveBehavior; //a_thing.m_buildBehavior = BuildFactory.CreateNewStandardBuild(a_player, a_thing); m_buildBehavior = BuildFactory.CreateNewVisibleBuild(a_player, this, a_player.m_thingsAssets.m_cube.m_buildBehavior.GetBuildRangeSquared(), a_map, a_pathfinder); }
public void OnPointerClick(PointerEventData eventData) { CurrentState = (CurrentState == AttackState) ? IdleState : JumpState; Attack = new StandardAttack(this); }