Vector2 v; // Sets the Sparken's velocity // Use this for initialization void Start() { rb2d = GetComponent <Rigidbody2D>(); animator = GetComponent <Animator>(); animationtestscript = GetComponent <AnimationTestScript>(); dialogueManager = GameObject.Find("Dialogue").GetComponent <DialogueManager>(); sparkenDialogueScript = new SparkenDialogueScript(); findClosestScript = new FindClosestScript(); currentMap = GameObject.FindGameObjectWithTag("Background"); fall = 0; grounded = false; speed = 2; hitpoints = 5; hitpointMaximum = 8; knockBackTimer = 0; knockBack = new Vector2(0, 0); alive = true; controllable = true; conversationable = true; rend = currentMap.GetComponent <Renderer>(); min = rend.bounds.min; max = rend.bounds.max; lastLanded = transform.position; // If the Sparken died, run from death script if (GameControllerScript.gameController.getWalkedOrDied() == false) { loadDeathPosition(); } // If the Sparken is spawning on a new map else if (GameControllerScript.gameController.getSparkenPlace() != new Vector3(0, 0, 0)) { loadPosition(GameControllerScript.gameController.getSparkenPlace()); hitpoints = GameControllerScript.gameController.getCurrentHealth(); } // If the Sparken has no declared spawn location, default to last landed else { godlyDescentTrigger(lastLanded); } }
private bool grounded; // Gets the grounded condition // Use this for initialization void Start() { animator = GetComponent <Animator>(); rb2 = GetComponent <Rigidbody2D>(); facing = false; moving = 0; doubleTapTime = 0.2f; hasZipped = false; playercontroller = GetComponent <PlayerController>(); projectileController = GetComponent <ProjectileController>(); sprite = GetComponent <SpriteRenderer>(); faceRight = new Vector3(1, 1, 1); faceLeft = new Vector3(-1, 1, 1); dialogueManager = GameObject.Find("Dialogue").GetComponent <DialogueManager>(); findClosestScript = new FindClosestScript(); sparkenDialogueScript = new SparkenDialogueScript(); }