void Start() { this.ballInteraction = GetComponent<BallInteraction>(); this.rb = GetComponent<Rigidbody>(); this.normalMovement = GetComponent<NormalMovement>(); this.cylinderMovement = GetComponent<CylinderMovement>(); }
private Goblin() { movingSpeed = 5.0f; movement = new NormalMovement(gameObject, rigidbody, movingSpeed); //매개변수 고민 attack1 = new NormalAttack(); state = new Battle(); //이 스테이트를 각각 어떻게 선언해야 하는가 ..... }
public void Drop(ItemPart item) { //Contract.Requires(HasItem(item)); if (!NormalMovement.IsOnGround()) { return; } Items.Remove(item); item.PlaceOnIsland(NormalMovement.GetPositionIsland()); }
/// <summary> /// Alternative design idea: create a decorator for the RobotNormalMovementPart, and have the simulate method do nothing when flying is enabled here /// </summary> public void SimulateMovement() { if (Flying) { //TODO: copy flying from other unit test } else { NormalMovement.SimulateMovement(); } if (Physical.Position.Y < -20) { Physical.Position = Physical.Position.ChangeY(50); NormalMovement.Velocity = new Vector3(); } }
public void ToggleFly() { if (Flying) { FlyingIsland = null; Flying = false; return; } if (NormalMovement.GetPositionIsland() == null) { return; // Not on island } FlyingIsland = NormalMovement.GetPositionIsland(); Flying = true; }
void Start() { this.cylinderMovement = GetComponent<CylinderMovement>(); this.normalMovement = GetComponent<NormalMovement>(); this.rigidBody = GetComponent<Rigidbody>(); this.cam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<CameraController>(); this.cylinders = GameObject.Find("Cylinders").transform; this.eyeObjects = new GameObject[] { transform.GetChild(0).FindChild("Left Eye").gameObject, transform.GetChild(0).FindChild("Right Eye").gameObject, transform.GetChild(0).FindChild("Eye Whites Sprite").gameObject }; GameObject charSprite = transform.GetChild(0).FindChild("Character Sprite").gameObject; anim = charSprite.GetComponent<Animator>(); movementType = MovementType.None; }