Example #1
0
    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();
    }
Example #2
0
        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>();
 }
Example #5
0
 public JumpCommand(PlayerMovement2D playerMovement)
 {
     this.playerMovement = playerMovement;
 }
Example #6
0
 public DashCommand(PlayerMovement2D playerMovement)
 {
     this.playerMovement = playerMovement;
 }
Example #7
0
 void Awake()
 {
     instance = this;
 }
Example #8
0
	// Use this for initialization
	void Start () {
		p_movement = player.GetComponent<PlayerMovement2D> ();
		cam = Camera.main.GetComponent<FollowPlayerCam> ();
	}
Example #9
0
 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> ();
 }