IEnumerator BeginningKnockback() { PlayerMovement2D movement = GetComponent <PlayerMovement2D>(); movement.DisbaleUserInput(); yield return(new WaitForSeconds(1)); Rigidbody2D rb = GetComponent <Rigidbody2D>(); rb.AddForce(Vector2.up * 2000f); knockback.Play(); yield return(new WaitForSeconds(1f)); movement.EnableUserInput(); }
public InteractionTrigger[] interactableList = new InteractionTrigger[0]; // List of the different interactable objects the npc can interact with private void Start() { if (!walkableLayer) { Debug.LogError("No walkable Layer reference found."); enabled = false; return; } // We force the Gameobject to have these components attacched to it, so no need to check the references npcMovement = GetComponent <PlayerMovement2D>(); npcAnimation = GetComponent <PlayerAnimation2D>(); if (fixedStartingPosition) { transform.position = levelStartingPosition.transform.position; } }
private void DealWithStragglers(Bounds b) { if (b.extents.x * 2 > maxAcceptablePlayerDistance) { if (thingsToTrack.Count == 1) { return; } GameObject leftmost = FindLeftmostThing(); if (leftmost) { PlayerMovement2D player = leftmost.GetComponent <PlayerMovement2D>(); int playerNum = player.GetPlayerNumber(); announcer.Announce("Player " + playerNum + " eliminated!", 1f); //TODO: consider instead teleporting to lead player and exhausting one life player.EliminateSelf(); thingsToTrack.Remove(leftmost); } } }
// Use this for initialization private void Start() { playerMovement = GetComponentInParent <PlayerMovement2D>(); }
public JumpCommand(PlayerMovement2D playerMovement) { this.playerMovement = playerMovement; }
public DashCommand(PlayerMovement2D playerMovement) { this.playerMovement = playerMovement; }
void Awake() { instance = this; }
// Use this for initialization void Start () { p_movement = player.GetComponent<PlayerMovement2D> (); cam = Camera.main.GetComponent<FollowPlayerCam> (); }
void Awake() { audio_source = GetComponent<AudioSource> (); shotFX = (AudioClip)Resources.Load ("SoundFX/enemy_shoot"); frogJumpFX = (AudioClip)Resources.Load ("SoundFX/frog_jump"); level_stats = GameObject.Find ("LevelLogic").GetComponent<LevelStats> (); player = GameObject.FindGameObjectWithTag ("Player").GetComponent<PlayerMovement2D> (); anim = GetComponent<Animator> (); }