void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Player") { ControllablePlayer player = collision.gameObject.GetComponent <ControllablePlayer>(); player.SetCheckpoint(transform.position); } }
void OnCollisionEnter(Collision collision) { if (collision.gameObject.tag == "Player") { ControllablePlayer player = collision.gameObject.GetComponent <ControllablePlayer>(); message.SetMessage("YOU ARE DEAD. WAY TO GO"); player.Kill(); } }
/* should just call onPickup, which will be overriden for each powerup */ //Make sure to distinguish which player picks it up void OnCollisionEnter(Collision collision) { if (collision.gameObject.GetComponent <ControllablePlayer>() != null) { //set the player for future reference player = collision.gameObject.GetComponent <ControllablePlayer>(); //calling on pickup on this passing a referance to controllable player this.onPickup(player); this.collider.enabled = false; this.renderer.enabled = false; } }
/// <summary> /// Use this as constructor. /// </summary> protected override void Initialize() { #if WINDOWS // Set console title. Console.Title = "Client"; IsMouseVisible = true; #else #endif // Initialize Members // ClientNetworkManager = new ClientNetworkManager(this); ClientNetworkManager.Connect("Vita", "10.17.23.15"); //TODO: find connections SpriteBatch = new SpriteBatch(GraphicsDevice); TileMap = new TileMap(this); Camera = new Camera(ScreenSize); #if PSM Camera.ConstrainToMap(TileMap, PSMScreenSize); #else Camera.ConstrainToMap(TileMap); #endif PhysicsWorld = new PhysicsWorld(this); ControllablePlayer = new ControllablePlayer(this, PhysicsWorld, ClientNetworkManager); Camera.Focus = ControllablePlayer; // Subscribe to network events // ClientNetworkManager.onPlayerConnected += ClientNetworkManager_OnPlayerConnected; ClientNetworkManager.onPlayerDisconnected += ClientNetworkManager_OnPlayerDisconnected; ClientNetworkManager.onPlayerMove += ClientNetworkManager_OnPlayerMove; ClientNetworkManager.onLocalPlayerConnected += ClientNetworkManager_OnLocalPlayerConnected; ClientNetworkManager.onPlayerAttack += ClientNetworkManager_OnPlayerAttack; // Initialize XNA base engine. base.Initialize(); }
void onPickup(ControllablePlayer player) { switch (powerType) { case Effect.SPEED: player.SetSpeed(speedIncrease); powerupTimer = 0f; speedIsIncreased = true; break; default: print("that powerup is unavailable"); break; } //star //immunity for 10 seconds //if there is a talent system this can either //increase to 20 seconds or //have 90 seconds of projectile protection or // more common drop timer (something to affect type of drops given //shield //absorbs a certain amount of damage //similair to star can be better or worse //wind, blows away enemies //magnet, pulls power ups 3 blocks away towards frogger //Hearts finish the level, collecting different types //froggers share heart pieces //are heart pieces randomly generated or not? //if heart pieces have fixed locations do the types of heart pieces at different locations change? }
/* (P only) Applies Input to connected player */ void ApplyInput(ControllablePlayer player, InputAction action) { player.AddMove(action); }