// Use this for initialization
    void Start()
    {
        soundManager     = GameObject.Find("SoundManager").GetComponent <SoundManager>();
        checkpointSystem = GameObject.Find("CheckpointSystem").GetComponent <CheckpointSystem>();
        if (checkpointSystem == null)
        {
            Debug.Log("No Checkpoint System found on scene.");
        }

        animatorController    = characterSprite.GetComponent <Animator>(); //Get reference to the animator
        GroundedToObjectsList = new List <GameObject> ();
        WalledToObjectsList   = new List <GameObject> ();

        //These define when collision is detected as a floor and when as a wall.
        Ground_X_MIN = -0.75f;
        Ground_X_MAX = 0.75f;
        Ground_Y_MIN = 0.5f;
        Ground_Y_MAX = 1f;

        //RootOBJ makes sure that character together with moving platforms
        GameObject ROOTOBJ = Instantiate(PlatformRoot_PREFAB, Vector3.zero, Quaternion.identity) as GameObject;

        PlatformRoot = ROOTOBJ.GetComponent <PlatformRoot> ();
        ROOTOBJ.name = "_PlatformRoot";

        //Default values for WallGrip Particle Emitter.
        WallGripEmissionRate           = 10;
        WallGripParticles.emissionRate = 0;

        //Player characters looks right in the start of the scene.
        isFacingRight = true;

        isDashing = false;
    }
Esempio n. 2
0
 public void SetupWorldData()
 {
     CheckpointSystem.SetSpawnPosition(Vector2.zero);
     CollectableDisplay.savedScore = 0;
     GameplayData.currentWorld     = worldID;
     PlayerHealth.ResetSavedHealth();
 }
Esempio n. 3
0
 void Start()
 {
     src        = GetComponent <AudioSource> ();
     normalStep = Step;
     check      = CheckpointSystem.GetComponent <CheckpointSystem> ();
     PlaceTrack();
     StartMetronome();
 }
    /// <summary>
    /// Sent when another object enters a trigger collider attached to this
    /// object (2D physics only).
    /// </summary>
    /// <param name="other">The other Collider2D involved in this collision.</param>
    void OnTriggerEnter2D(Collider2D other)
    {
        CheckpointSystem cs = other.GetComponent <CheckpointSystem>();

        if (cs)
        {
            cs.softCheckpoint = checkpoint.position;
        }
    }
Esempio n. 5
0
 private void Start()
 {
     spriteRenderer           = GetComponent <SpriteRenderer>();
     circleCollider           = GetComponent <CircleCollider2D>();
     circleCollider.isTrigger = true;
     checkpoint = Respawner.instance.GetCheckpointSystem(index);
     if (index < 17)
     {
         nextCheckPoint = Respawner.instance.GetCheckpointSystem(index + 1);
     }
 }
Esempio n. 6
0
 private void Start()
 {
     anim = GetComponent <Animator>();
     if (checkpointSystem == null)
     {
         checkpointSystem = GameObject.FindGameObjectWithTag("Player").GetComponent <CheckpointSystem>();
     }
     if (soundController == null)
     {
         soundController = GameObject.FindGameObjectWithTag("Player").GetComponent <SoundController>();
     }
 }
Esempio n. 7
0
 // Start is called before the first frame update
 void Start()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
     player = FindObjectOfType <PlayerController>();
 }
    private void Awake()
    {
        if (instance == null)
        {
            DontDestroyOnLoad(gameObject);
            Body = FindObjectOfType <Body>();
            Soul = FindObjectOfType <Soul>();

            instance = this;
            return;
        }
        Destroy(this);
    }
Esempio n. 9
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.CompareTag("Player"))
        {
            Debug.Log("checkpoint caught at " + collision.transform.position);

            Collider2D collider2D = GetComponent <Collider2D>();
            if (collider2D)
            {
                collider2D.enabled = false;
            }

            CheckpointSystem.SetSpawnPosition(transform.position + spawnOffset);

            CollectableDisplay.instance.SaveScore();
            BonusCollectableManager.SaveCollectedStates();
        }
    }
 /// <summary>
 /// Awake is called when the script instance is being loaded.
 /// </summary>
 void Awake()
 {
     character        = GetComponent <CharacterController2D>();
     checkpoint       = GetComponent <CheckpointSystem>();
     interact         = GetComponent <InteractSystem>();
     cameraController = GameObject.FindObjectOfType <CameraController>();
     if (!cameraController)
     {
         Debug.LogError("The scene is missing a camera controller! The player script needs it to work properly!");
     }
     controls.Player.Movement.performed += ctx => Move(ctx.ReadValue <Vector2>());
     controls.Player.Movement.cancelled += ctx => Move(Vector2.zero);
     controls.Player.Jump.started       += Jump;
     controls.Player.Jump.cancelled     += EndJump;
     controls.Player.Dash.started       += Dash;
     controls.Player.Interact.started   += Interact;
     controls.Player.AttackA.started    += Attack;
 }
Esempio n. 11
0
    void Start()
    {
        playerPhaseManager = PlayerPhaseManager.instance;
        if (playerPhaseManager)
        {
            playerPhaseManager.gameManager = this;

            Vector2 spawnPosition = CheckpointSystem.GetSpawnPosition();
            if (spawnPosition == Vector2.zero)
            {
                CheckpointSystem.SetSpawnPosition(playerPhaseManager.transform.position);
            }
            else
            {
                playerPhaseManager.transform.position = spawnPosition;
            }
            playerPhaseManager.StartCoroutine(playerPhaseManager.Spawn());
        }
    }
Esempio n. 12
0
 // Use this for initialization
 void Start()
 {
     checkpointSystem = GameObject.Find("CheckpointSystem").GetComponent <CheckpointSystem>();
 }
Esempio n. 13
0
 public void SetOwner(CheckpointSystem systemObj)
 {
     Owner = systemObj;
 }