// Use this for initialization void Start() { rb = GetComponent <Rigidbody2D>(); playerCam = GetComponentInChildren <Camera>(); playerCam.transform.position = new Vector3(rb.transform.position.x, rb.transform.position.y, -0.3f); playerCam.fieldOfView = 177; flipMe = GetComponent <SyncFlip>(); }
void Start() { syncFlip = GetComponent <SyncFlip>(); syncFlip.player = this; StartCoroutine("nameFix"); animator = GetComponent <AnimationManager>(); CameraExpander cam = GameObject.Find("Main Camera").GetComponent <CameraExpander>(); cam.UpdatePlayers(); if (!isLocalPlayer && !isAI) { return; } controller = GetComponent <Controller2D>(); pistol = GetComponent <Pistol>(); shotgun = GetComponent <Shotgun>(); plasmaCannon = GetComponent <PlasmaCannon>(); dropShotgun = Resources.Load("DropShotgun") as GameObject; dropCannon = Resources.Load("DropCannon") as GameObject; jump = 0; gravity = (2 * maxJumpHeight) / Mathf.Pow(timeToJumpApex, 2); maxJumpVelocity = Mathf.Abs(gravity) * timeToJumpApex; minJumpVelocity = Mathf.Sqrt(2 * Mathf.Abs(gravity) * minJumpHeight); movementAxis = new Vector2(0, 0); buttonPressedJump = false; buttonHeldJump = false; buttonReleasedJump = false; buttonPressedShoot = false; buttonHeldShoot = false; buttonReleasedShoot = true; buttonPressedAction = false; buttonPressedReload = false; buttonPressedReturn = false; currentPlatform = null; currentPosition = 2; }
// Use this for initialization void Start() { AI = transform.GetComponent <Player> (); Spawns = transform.Find("spawn"); playerFinder = transform.GetComponent <PlayerFinder> (); player = playerFinder.getPlayerTransform(); AISync = transform.GetComponent <SyncFlip> (); spawn0 = Spawns.GetChild(0); spawn1 = Spawns.GetChild(1); spawn2 = Spawns.GetChild(2); spawn3 = Spawns.GetChild(3); spawn4 = Spawns.GetChild(4); v0_4_0 = new Vector3(0, 4, 0); prevXPos = transform.position.x; }
void Start() { Canvas[] canvases; if (!isLocalPlayer) { canvases = this.GetComponentsInChildren <Canvas>(); canvases[0].enabled = false; canvases[1].enabled = false; return; } // Ensures that corresponding canvases attached to players only spawn on current player, and not // everyone else's screens canvases = this.GetComponentsInChildren <Canvas>(); canvases[0].enabled = true; canvases[1].enabled = true; rb = GetComponent <Rigidbody2D>(); // Obtain rigid body component to whom this script is attached to anim = GetComponent <Animator>(); // Obtain animator to access varibles set to player animator flipMe = GetComponent <SyncFlip>(); SpawnPoints spawnPoint = GameObject.Find("Spawn1").GetComponent <SpawnPoints>(); anim.SetBool("IsMoving", false); if (this.tag == "Player1") { this.transform.position = spawnPoint.spawnPoints[0].transform.position; } else if (this.tag == "Player2") { this.transform.position = spawnPoint.spawnPoints[1].transform.position; } else if (this.tag == "Player3") { this.transform.position = spawnPoint.spawnPoints[2].transform.position; } else if (this.tag == "Player4") { this.transform.position = spawnPoint.spawnPoints[3].transform.position; } }
void Awake() { syncFlip = GetComponent <SyncFlip>(); networkManager = GameObject.FindGameObjectWithTag("NetworkManager").GetComponent <NetworkManager>(); }