public override FSMNode doActivity() { // On animation completion, select next node if (_anim.GetCurrentAnimatorStateInfo(0).IsName("idle")) { Utils.pickingStates ps = controller.pickTree(pickTarget); Walking walkNode = gameObject.AddComponent(typeof(Walking)) as Walking; walkNode.controller = this.controller; //animation finished if (ps == Utils.pickingStates.newTree) // walk to random tree { walkNode.target = controller.selectRandomTree(); exit(); return(walkNode); } else // walk to village for drop off { walkNode.target = controller.selectVillage(); exit(); return(walkNode); } } return(this); }
void Awake() { audioSource = GetComponent <AudioSource>(); //events Health health = GetComponent <Health>(); if (health) { health.damaged += RecieveDamage; } Walking walking = GetComponent <Walking>(); if (walking) { walking.jump += PlayPrimary; } //Weapon Weapon weapon = GetComponent <Weapon>(); if (weapon) { weapon.strike += PlayPrimary; } }
void Awake() { health = GetComponent <Health>(); walking = GetComponent <Walking>(); appearance = GetComponent <Appearance>(); weapon = GetComponentInChildren <Weapon>(); }
void Start() { rigidbody.freezeRotation = true; faction = gameObject.GetComponent<Faction> (); walking = gameObject.GetComponent<Walking> (); rotating = gameObject.GetComponent<Rotating> (); }
// skickar in inputen för typen av sport // båda int variablerna går igenom en try catch för att kolla så de är int //en instansiering av klassen görs sen skickar vi in Seconds och Meters till addWorkout för att lägga till en färdig träning private void chooseTypOfTraining(enumSportMenu Choice2) { int inputMeters = GetWorkoutDistance(); int inputSeconds = GetWorkoutTime(); switch (Choice2) { case enumSportMenu.Running: ClassLibrary.Running runningWorkout = new Running(); runningWorkout.AddWorkout(inputMeters, inputSeconds); break; case enumSportMenu.Walking: ClassLibrary.Walking walkingWorkout = new Walking(); walkingWorkout.AddWorkout(inputMeters, inputSeconds); break; case enumSportMenu.Biking: ClassLibrary.Biking bikingWorkout = new Biking(); bikingWorkout.AddWorkout(inputMeters, inputSeconds); break; default: throw new ArgumentOutOfRangeException("Only 1-3"); } Console.ReadLine(); }
//Finding all GameObjects needed in the script void Start() { thePlayer = GameObject.Find("Character"); walkingScript = thePlayer.GetComponent <Walking>(); lever1Script = lever1.GetComponent <Lever1>(); lever3Script = lever3.GetComponent <Lever3>(); }
void Awake() { walking = GetComponentInParent <Walking>(); if (walking) { walking.switchDirection += Turn; } }
//Finding all GameObjects needed in the script void Start() { thePlayer = GameObject.Find("Character"); walkingScript = thePlayer.GetComponent <Walking>(); fadeGameObject = GameObject.Find("FadeColor"); fadeScript = fadeGameObject.GetComponent <Fade>(); }
void Start() { walking = GetComponent<Walking>(); gyro = SystemInfo.supportsGyroscope; if(gyro) Input.gyro.enabled = true; }
void Awake() { _walking = GetComponent <Walking>(); _capsule = GetComponent <CapsuleCollider2D>(); _lm = FindObjectOfType <LevelManager>(); SetLvl(_lm.marioLvl); _lm.StartLevel(); }
public ActionResult CreateActivity(int i = 0) { DateTime startTime = new DateTime(); DateTime endTime = new DateTime(); string name = Request.Form[1]; string description = Request.Form[2]; int capacity = int.Parse(Request.Form[3]); decimal price = decimal.Parse(Request.Form[4]); if (DateTime.TryParse(Request.Form[5].ToString(), out DateTime resultStartTime)) { startTime = resultStartTime; } if (DateTime.TryParse(Request.Form[6].ToString(), out DateTime resultEndTime)) { endTime = resultEndTime; } int subjectId = int.Parse(Request.Form[7]); switch (subjectId) { //Jazz case 5: Jazz jazz = new Jazz { Name = name, Description = description, Capacity = capacity, Price = price, StartTime = startTime, EndTime = endTime, LocationId = 21, SubjectId = subjectId }; activityRepo.Insert(jazz); break; //Talking case 6: Talking talking = new Talking { Name = name, Description = description, Capacity = capacity, Price = price, StartTime = startTime, EndTime = endTime, LocationId = 22, SubjectId = subjectId }; activityRepo.Insert(talking); break; //Historic case 7: Walking walking = new Walking { Name = name, Description = description, Capacity = capacity, Price = price, StartTime = startTime, EndTime = endTime, LocationId = 23, SubjectId = subjectId }; activityRepo.Insert(walking); break; //Dining case 8: Dining dining = new Dining { Name = name, Description = description, Capacity = capacity, Price = price, StartTime = startTime, EndTime = endTime, LocationId = 23, SubjectId = subjectId }; activityRepo.Insert(dining); break; } return(RedirectToAction("ActivityDetails")); }
//Finding all GameObjects needed in the script void Start() { thePlayer = GameObject.Find("Character"); walkingScript = thePlayer.GetComponent <Walking>(); itemC = GameObject.Find("C").GetComponent <Image>(); itemD = GameObject.Find("D").GetComponent <Image>(); itemE = GameObject.Find("E").GetComponent <Image>(); }
void Start() { desiredDirection = Quaternion.identity; walking = gameObject.GetComponent<Walking> (); rotating = gameObject.GetComponent<Rotating> (); shooting = gameObject.GetComponent<Shooting> (); swinging = gameObject.GetComponent<Swinging> (); energy = gameObject.GetComponent<Energy> (); }
//Checks if grounded public void FixedUpdate() { bool Grounded = OnGround; OnGround = false; Collider2D[] colliders = Physics2D.OverlapCircleAll(ObjectCheck.position, HeadCollider, IsGround); for (int i = 0; i < colliders.Length; i++) { if (colliders[i].gameObject != gameObject) { OnGround = true; if (!Grounded) { OnLandEvent.Invoke(); } } } if (OnGround == true) { //Attack Command if (Input.GetButtonDown("Fire1")) { Attack.Invoke(); } Vector3 targetVelocity = new Vector2(MoveSpeed * Input.GetAxis("Horizontal"), Controller.velocity.y); //Moves Character Controller.velocity = Vector3.SmoothDamp(Controller.velocity, targetVelocity, ref C_Velocity, MoveSmoother); Walking.Invoke(); //Flips Character direction if (Input.GetAxis("Horizontal") > 0 && !FaceRight || Input.GetAxis("Horizontal") < 0 && FaceRight) { FaceRight = !FaceRight; Vector3 CScale = transform.localScale; CScale.x *= -1; transform.localScale = CScale; } //Activate jump if (Input.GetButton("Jump")) { OnGround = false; Controller.AddForce(new Vector2(0f, JumpSpeed)); } if (!Input.GetButton("Horizontal")) { Idle.Invoke(); } } }
public States(Player player) { this.player = player; falling = new Falling(player); walking = new Walking(player); dead = new Dead(player); wallgrab = new WallGrab(player); jump = new Jump(player); doublejump = new DoubleJump(player); }
void Awake() { HitOnContact hitOnContact = GetComponent <HitOnContact>(); Walking walking = GetComponentInParent <Walking>(); if (walking) { hitOnContact.hit += walking.AirJump; } }
// Start is called before the first frame update void Start() { stateMachine = new StateMachine(); standing = new Standing(stateMachine); running = new Running(stateMachine); ducking = new Ducking(stateMachine); jumping = new Jumping(stateMachine); walking = new Walking(stateMachine); stateMachine.HandleInput(); }
//Finding all GameObjects needed in the script void Start() { thePlayer = GameObject.Find("Character"); walkingScript = thePlayer.GetComponent <Walking>(); itemF = GameObject.Find("F"); itemG = GameObject.Find("G").GetComponent <Image>(); itemH = GameObject.Find("H").GetComponent <Image>(); }
void Awake() { // Get references rb = GetComponent <Rigidbody>(); anim = GetComponent <Animator>(); // Instantiate states idleState = new IdleState(gameObject); walkingState = new Walking(gameObject); attackingState = new Attacking(gameObject); }
public void killerStare() { if (killer) { foreach (GameObject item in peoples) { Walking walking = item.GetComponent <Walking>(); walking.speed = 0; } } }
private void Awake() { if (horizontal) { Walking walking = GetComponentInParent <Walking>(); if (walking) { walking.switchDirection += InvertDirection; } } }
//Finding all GameObjects needed in the script void Start() { thePlayer = GameObject.Find("Character"); walkingScript = thePlayer.GetComponent <Walking>(); itemD = GameObject.Find("D"); //Checking if the crystal was used so when player leaves the room display the sprite again upon entering if (walkingScript.itemUsed[4] == true) { redCrystal.SetActive(true); } }
public override void Update() { foreach (ref readonly Entity entity in entities.GetEntities()) { ref Walking walking = ref entity.Get <Walking>(); // If you're not trying to walk, then there's nothing to do here if (walking.Current == 0) { continue; } ref Body body = ref entity.Get <Body>();
public void AssignCreature(GameObject creature) { playerCreature = creature; walkingPlayer = creature.GetComponent <Walking>(); //events Health health = creature.GetComponent <Health>(); if (health) { health.damaged += ScreenShake; } }
//Don't Destroy on Load Function void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(gameObject); } else if (instance != this) { Destroy(this.gameObject); return; } }
// Start is called before the first frame update void Awake() { _rigidbody = GetComponent <Rigidbody>(); _animator = GetComponent <Animator>(); _idleState = new Idle(this); _aimState = new Aim(this); _walkingState = new Walking(this); _throwState = new Throw(this); _controls = new InputPlayerControls(); ControlsInitialization(); }
//Finding all GameObjects needed in the script void Start() { thePlayer = GameObject.Find("Character"); walkingScript = thePlayer.GetComponent <Walking>(); lever1Script = lever1.GetComponent <Lever1>(); lever2Script = lever2.GetComponent <Lever2>(); lever3Script = lever3.GetComponent <Lever3>(); //itemC = GameObject.Find("C"); itemC = GameObject.Find("C"); itemE = GameObject.Find("E"); itemF = GameObject.Find("F").GetComponent <Image>(); }
public override FSMNode doActivity() { controller.dropApples(); // On animation completion, select next node if (_anim.GetCurrentAnimatorStateInfo(0).IsName("idle")) { Walking walkNode = gameObject.AddComponent(typeof(Walking)) as Walking; walkNode.controller = this.controller; walkNode.target = controller.selectRandomTree(); exit(); return(walkNode); } return(this); }
//Finding all GameObjects needed in the script void Start() { thePlayer = GameObject.Find("Character"); itemG = GameObject.Find("G"); walkingScript = thePlayer.GetComponent <Walking> (); if (walkingScript.itemObtained[0] == false) { itemA = GameObject.Find("A").GetComponent <Image>(); } //Not displaying NPC after entering the room again once the NPC is on the center room if (walkingScript.NPC1Unlock == true) { gameObject.SetActive(false); } }
void Awake() { Cursor.lockState = CursorLockMode.Locked; m_CanInteract = true; m_PlayerAnim = GetComponentInChildren <Animator>(); m_Controller = GetComponent <CharacterController>(); m_PlayerGliding = GetComponent <Gliding>(); m_PlayerWalking = GetComponent <Walking>(); m_StaminaComponent = GetComponent <StaminaComponent>(); m_HookPosDetection = GetComponent <HookPosDetection>(); // Permet de conserver en mémoire les materials originels des vêtements m_ClothSavedMaterial = m_Cloth.materials[0]; m_PagneSavedMaterial = m_Pagne.materials[0]; }
void Awake() { spriteRenderer = GetComponent <SpriteRenderer>(); //events Walking walking = GetComponent <Walking>(); if (walking) { walking.switchDirection += SwitchDirection; } Health health = GetComponent <Health>(); if (health) { health.damaged += Damaged; health.died += Dead; } }
void Start() { physicController = GetComponent <EnhancedPhysicController>(); walking = GetComponent <Walking>(); jumping = GetComponent <Jumping>(); dashing = GetComponent <Dashing>(); var movementsInputs = inputs.FindActionMap("Movements"); movementsInputs.Enable(); movementsInputs["MoveForward"].performed += OnMoveForward; movementsInputs["MoveRight"].performed += OnMoveRight; movementsInputs["Jump"].performed += OnJump; movementsInputs["LookAt"].performed += OnLookAt; //movementsInputs["LookAt"].canceled += OnStopLookAt; movementsInputs["Dash"].performed += OnDash; onJumpActions.Add(() => { audioSource.clip = jumpSound; audioSource.Play(); }); onDashActions.Add(() => { audioSource.clip = dashSound; audioSource.Play(); }); }
private void Awake() { // speedLinesParticleSystem = transform.Find("Camera").Find("SpeedLinesParticleSystem").GetComponent<ParticleSystem>(); Cursor.lockState = CursorLockMode.Locked; m_State = State.Normal; m_HookShotOrigin.gameObject.SetActive(false); m_HookPosDetection = GetComponent <HookPosDetection>(); m_PlayerGliding = GetComponent <Gliding>(); m_PlayerWalking = GetComponent <Walking>(); m_PlayerWallGliding = GetComponent <WallGliding>(); m_PlayerAnim = GetComponentInChildren <Animator>(); m_StaminaComponent = GetComponent <StaminaComponent>(); //for (int i = 0; i < m_Cloth.Length; i++) //{ // m_SavedMaterial[i] = m_Cloth[i].materials[0]; //} m_ClothSavedMaterial = m_Cloth.materials[0]; m_PagneSavedMaterial = m_Pagne.materials[0]; // m_HookLine = m_HookShotOrigin.GetComponent<LineRenderer>(); // Debug.Log(CinemachineComponent.m_Lens.FieldOfView); }
void Start() { rotating = gameObject.GetComponent<Rotating> (); walking = gameObject.GetComponent<Walking> (); }
void Awake() { walking = GetComponent<Walking>(); }