private void Awake() { if (claire) { claireCharacter = this.GetComponent <Claire>(); maxHealth = claireCharacter.maxHealth; currentHealth = maxHealth; regenHeath = maxHealth; speed = claireCharacter.speed; weight = claireCharacter.weight; //gravityUp = claireCharacter.gravityUp; //gravityDown = claireCharacter.gravityDown; jumpVel = claireCharacter.jumpVel; maxDownVel = claireCharacter.maxDownVel; } if (gillbert) { gillbertCharacter = this.GetComponent <Gillbert>(); maxHealth = gillbertCharacter.maxHealth; currentHealth = maxHealth; regenHeath = maxHealth; speed = gillbertCharacter.speed; weight = gillbertCharacter.weight; gravityUp = gillbertCharacter.gravityUp; gravityDown = gillbertCharacter.gravityDown; jumpVel = gillbertCharacter.jumpVel; maxDownVel = gillbertCharacter.maxDownVel; currentGilbertFlightTime = gilbertFlightTime; } if (gnomercy) { gnomercyCharacter = this.GetComponent <Gnomercy>(); maxHealth = gnomercyCharacter.maxHealth; currentHealth = maxHealth; regenHeath = maxHealth; speed = gnomercyCharacter.speed; weight = gnomercyCharacter.weight; gravityUp = gnomercyCharacter.gravityUp; gravityDown = gnomercyCharacter.gravityDown; jumpVel = gnomercyCharacter.jumpVel; maxDownVel = gnomercyCharacter.maxDownVel; } if (wawa) { wawaCharacter = this.GetComponent <Watermelon>(); maxHealth = wawaCharacter.maxHealth; currentHealth = maxHealth; speed = wawaCharacter.speed; weight = wawaCharacter.weight; gravityUp = wawaCharacter.gravityUp; gravityDown = wawaCharacter.gravityDown; jumpVel = wawaCharacter.jumpVel; maxDownVel = wawaCharacter.maxDownVel; } //Rewired Code myPlayer = ReInput.players.GetPlayer(playerNum - 1); ReInput.ControllerConnectedEvent += OnControllerConnected; CheckController(myPlayer); }
private void Awake() { mainCamera = GameObject.Find("Main Camera"); if (claire) { claireCharacter = this.GetComponent <Claire>(); maxHealth = claireCharacter.maxHealth; currentHealth = maxHealth; regenHeath = maxHealth; speed = claireCharacter.speed; weight = claireCharacter.weight; gravityUp = claireCharacter.gravityUp; gravityDown = claireCharacter.gravityDown; jumpVel = claireCharacter.jumpVel; maxDownVel = claireCharacter.maxDownVel; } if (gillbert) { gillbertCharacter = this.GetComponent <Gillbert>(); maxHealth = gillbertCharacter.maxHealth; currentHealth = maxHealth; regenHeath = maxHealth; speed = gillbertCharacter.speed; weight = gillbertCharacter.weight; gravityUp = gillbertCharacter.gravityUp; gravityDown = gillbertCharacter.gravityDown; jumpVel = gillbertCharacter.jumpVel; maxDownVel = gillbertCharacter.maxDownVel; currentGilbertFlightTime = gilbertFlightTime; } if (gnomercy) { gnomercyCharacter = this.GetComponent <Gnomercy>(); maxHealth = gnomercyCharacter.maxHealth; currentHealth = maxHealth; regenHeath = maxHealth; speed = gnomercyCharacter.speed; weight = gnomercyCharacter.weight; gravityUp = gnomercyCharacter.gravityUp; gravityDown = gnomercyCharacter.gravityDown; jumpVel = gnomercyCharacter.jumpVel; maxDownVel = gnomercyCharacter.maxDownVel; } if (wawa) { wawaCharacter = this.GetComponent <Watermelon>(); maxHealth = wawaCharacter.maxHealth; currentHealth = maxHealth; speed = wawaCharacter.speed; weight = wawaCharacter.weight; gravityUp = wawaCharacter.gravityUp; gravityDown = wawaCharacter.gravityDown; jumpVel = wawaCharacter.jumpVel; maxDownVel = wawaCharacter.maxDownVel; } //Rewired Code myPlayer = ReInput.players.GetPlayer(playerNum - 1); ReInput.ControllerConnectedEvent += OnControllerConnected; CheckController(myPlayer); rigPieces = GetComponentsInChildren <SpriteRenderer>(); if (playerNum == 1) { foreach (SpriteRenderer sprite in rigPieces) { if (sprite != null) { sprite.sortingLayerName = "Player 1"; } } } else { if (playerNum == 2) { foreach (SpriteRenderer sprite in rigPieces) { if (sprite != null) { sprite.sortingLayerName = "Player 2"; } } } } }
void Awake() { mainCamera = GameObject.Find("Main Camera"); //grabbing character specific values from their respective characters if (claire) { claireCharacter = this.GetComponent <Claire>(); maxHealth = claireCharacter.maxHealth; currentHealth = maxHealth; regenHeath = maxHealth; speed = claireCharacter.speed; weight = claireCharacter.weight; //gravityUp = claireCharacter.gravityUp; //gravityDown = claireCharacter.gravityDown; jumpVel = claireCharacter.jumpVel; maxDownVel = claireCharacter.maxDownVel; } if (gillbert) { gillbertCharacter = this.GetComponent <Gillbert>(); maxHealth = gillbertCharacter.maxHealth; currentHealth = maxHealth; regenHeath = maxHealth; speed = gillbertCharacter.speed; weight = gillbertCharacter.weight; gravityUp = gillbertCharacter.gravityUp; gravityDown = gillbertCharacter.gravityDown; jumpVel = gillbertCharacter.jumpVel; maxDownVel = gillbertCharacter.maxDownVel; currentGilbertFlightTime = gilbertFlightTime; } if (gnomercy) { gnomercyCharacter = this.GetComponent <Gnomercy>(); maxHealth = gnomercyCharacter.maxHealth; currentHealth = maxHealth; regenHeath = maxHealth; speed = gnomercyCharacter.speed; weight = gnomercyCharacter.weight; gravityUp = gnomercyCharacter.gravityUp; gravityDown = gnomercyCharacter.gravityDown; jumpVel = gnomercyCharacter.jumpVel; maxDownVel = gnomercyCharacter.maxDownVel; } if (wawa) { wawaCharacter = this.GetComponent <Watermelon>(); maxHealth = wawaCharacter.maxHealth; currentHealth = maxHealth; speed = wawaCharacter.speed; weight = wawaCharacter.weight; gravityUp = wawaCharacter.gravityUp; gravityDown = wawaCharacter.gravityDown; jumpVel = wawaCharacter.jumpVel; maxDownVel = wawaCharacter.maxDownVel; } //Rewired Code myPlayer = ReInput.players.GetPlayer(playerNum - 1); ReInput.ControllerConnectedEvent += OnControllerConnected; CheckController(myPlayer); rigPieces = GetComponentsInChildren <SpriteRenderer>(); if (playerNum == 1) { foreach (SpriteRenderer sprite in rigPieces) { if (sprite != null) { sprite.sortingLayerName = "Player 1"; } } } else { if (playerNum == 2) { foreach (SpriteRenderer sprite in rigPieces) { if (sprite != null) { sprite.sortingLayerName = "Player 2"; } } } } outlineColor = Shader.Find("GUI/Text"); if (teamNum == 1) { foreach (SpriteRenderer sprite in rigPieces) { if (sprite.sortingLayerName == "Outline") { sprite.material.shader = outlineColor; sprite.color = Color.red; } } } if (teamNum == 2) { foreach (SpriteRenderer sprite in rigPieces) { if (sprite.sortingLayerName == "Outline") { sprite.material.shader = outlineColor; sprite.color = Color.blue; } } } }