// Start is called before the first frame update
 void Start()
 {
     frictionEnabled = false;
     JumpStrength    = minJumpStrength;
     SlimeState      = SlimeState.Falling;
     try
     {
         rb = gameObject.GetComponent <Rigidbody2D>();
     }
     catch (System.NullReferenceException e)
     {
         Debug.LogError("The PlayerController requires a Rigidbody2D! Generating one instead...\nException: " + e);
         rb = gameObject.AddComponent <Rigidbody2D>();
     }
     finally
     {
         rb.gravityScale   = this.gravityScale;
         rb.mass           = 1;
         rb.freezeRotation = true;
     }
     if (arcManager == null)
     {
         try
         {
             arcManager = GameObject.FindObjectOfType <ArcManager>();
         }
         catch (System.NullReferenceException e)
         {
             Debug.LogError("You need to have an ArcManager in the Scene to use a PlayerController!\nException: " + e);
             throw e;
         }
     }
     arcManager.enabled = false;
 }
Exemple #2
0
    // Start is called before the first frame update
    void Start()
    {
        if (!singleton)
        {
            DontDestroyOnLoad(gameObject);
            singleton = this;
        }
        else
        {
            Destroy(gameObject);
        }

        if (!arc_base[0])
        {
            Spown();
        }
    }
Exemple #3
0
 void Awake()
 {
     Instance = this;
 }