public IEnumerator LoadWWW() { PlayerS playersLoad = new PlayerS(); //weaponProperties = new List<WeaponProperties>(); string filePath = Application.streamingAssetsPath + "/PlayerInit.json"; WWW www = new WWW(filePath); while (!www.isDone) { yield return(null); } string jsonStr = www.text; playersLoad = JsonMapper.ToObject <PlayerS>(jsonStr); foreach (PlayerJson playerJs in playersLoad.playerJsons) { if (!JsonSingle.Single.PlayerJsonData.ContainsKey(playerJs.Name)) { JsonSingle.Single.PlayerJsonData.Add(playerJs.Name, new Dictionary <string, int>()); } foreach (KeyValuePair <string, int> js in playerJs.DataPlayer) { JsonSingle.Single.PlayerJsonData[playerJs.Name].Add(js.Key, js.Value); } } }
public static bool OnSameTeam(PlayerS p1, PlayerS p2) { int p1Team = teamNumber[p1.playerNum-1]; int p2Team = teamNumber[p2.playerNum-1]; return (p1Team == p2Team); }
public void LoadWeaponProperty() { if (!PlayerPrefs.HasKey("Player1Attack")) { PlayerS playersLoad = new PlayerS(); //weaponProperties = new List<WeaponProperties>(); string filePath = Application.streamingAssetsPath + "/PlayerInit.json"; WWW www = new WWW(filePath); string jsonStr = www.text; playersLoad = JsonMapper.ToObject <PlayerS>(jsonStr); ////判断是否存在这个文件 //if (File.Exists(filePath)) //{ // //读取文件流 // StreamReader sr = new StreamReader(filePath); // //读完 // string jsonStr = sr.ReadToEnd(); // //关闭文件流 // sr.Close(); // //给列表赋值 // playersLoad = JsonMapper.ToObject<PlayerS>(jsonStr); // //Debug.Log(playersLoad.playerJsons[0].DataPlayer["攻击"]); //} foreach (PlayerJson playerJs in playersLoad.playerJsons) { if (!JsonSingle.Single.PlayerJsonData.ContainsKey(playerJs.Name)) { JsonSingle.Single.PlayerJsonData.Add(playerJs.Name, new Dictionary <string, int>()); } foreach (KeyValuePair <string, int> js in playerJs.DataPlayer) { JsonSingle.Single.PlayerJsonData[playerJs.Name].Add(js.Key, js.Value); } } PlayerPrefs.SetInt("Player1Attack", JsonSingle.Single.PlayerJsonData["Player1"]["攻击"]); PlayerPrefs.SetInt("Player1Speed", JsonSingle.Single.PlayerJsonData["Player1"]["攻速"]); PlayerPrefs.SetInt("Player1Life", JsonSingle.Single.PlayerJsonData["Player1"]["生命"]); PlayerPrefs.SetInt("Player1Diamond", JsonSingle.Single.PlayerJsonData["Player1"]["钻石"]); PlayerPrefs.SetInt("Player1Icon", JsonSingle.Single.PlayerJsonData["Player1"]["金币"]); PlayerPrefs.SetInt("Player2Attack", JsonSingle.Single.PlayerJsonData["Player2"]["攻击"]); PlayerPrefs.SetInt("Player2Speed", JsonSingle.Single.PlayerJsonData["Player2"]["攻速"]); PlayerPrefs.SetInt("Player2Life", JsonSingle.Single.PlayerJsonData["Player2"]["生命"]); PlayerPrefs.SetInt("Player2Diamond", JsonSingle.Single.PlayerJsonData["Player2"]["钻石"]); PlayerPrefs.SetInt("Player2Icon", JsonSingle.Single.PlayerJsonData["Player2"]["金币"]); PlayerPrefs.SetInt("Player3Attack", JsonSingle.Single.PlayerJsonData["Player3"]["攻击"]); PlayerPrefs.SetInt("Player3Speed", JsonSingle.Single.PlayerJsonData["Player3"]["攻速"]); PlayerPrefs.SetInt("Player3Life", JsonSingle.Single.PlayerJsonData["Player3"]["生命"]); PlayerPrefs.SetInt("Player3Diamond", JsonSingle.Single.PlayerJsonData["Player3"]["钻石"]); PlayerPrefs.SetInt("Player3Icon", JsonSingle.Single.PlayerJsonData["Player3"]["金币"]); PlayerPrefs.SetInt("Icon", JsonSingle.Single.PlayerJsonData["iconAndDiamond"]["Icon"]); PlayerPrefs.SetInt("Diamond", JsonSingle.Single.PlayerJsonData["iconAndDiamond"]["Diamond"]); } }
void Update() { if (!myPlayer && playerNum != 5){ myPlayer = GameObject.Find("Player"+playerNum).GetComponent<PlayerS>(); mySprite = GetComponent<SpriteRenderer>(); mySprite.color = playerCols[myPlayer.characterNum-1]; } }
// Start is called before the first frame update void Start() { stats = new StatStruct(); stats.dir = true; stats.dX = dX; stats.dY = dY; createEnemy(); playerobj = GameObject.FindGameObjectWithTag("Plyr"); plyrInit = playerobj.GetComponent <PlayerS>(); prevW = plyrInit.wType; }
private void Awake() { m_Rigidbody2D = GetComponent <Rigidbody2D>(); if (OnLandEvent == null) { OnLandEvent = new UnityEvent(); } if (OnCrouchEvent == null) { OnCrouchEvent = new BoolEvent(); } pls = GameObject.Find("Player").GetComponent <PlayerS>(); }
public void Init() { player1.Name = "Player1"; player1.DataPlayer.Add("攻击", 30); player1.DataPlayer.Add("攻速", 20); player1.DataPlayer.Add("生命", 20); player1.DataPlayer.Add("钻石", 20); player1.DataPlayer.Add("金币", 20); player2.Name = "Player2"; player2.DataPlayer.Add("攻击", 30); player2.DataPlayer.Add("攻速", 30); player2.DataPlayer.Add("生命", 30); player2.DataPlayer.Add("钻石", 20); player2.DataPlayer.Add("金币", 20); player3.Name = "Player3"; player3.DataPlayer.Add("攻击", 40); player3.DataPlayer.Add("攻速", 40); player3.DataPlayer.Add("生命", 40); player3.DataPlayer.Add("钻石", 20); player3.DataPlayer.Add("金币", 20); iconAndDiamond.Name = "iconAndDiamond"; iconAndDiamond.DataPlayer.Add("Icon", 1000); iconAndDiamond.DataPlayer.Add("Diamond", 1000); // PlayerS players = new PlayerS(); players.playerJsons = new PlayerJson[] { player1, player2, player3, iconAndDiamond }; string jsonStr = JsonMapper.ToJson(players); PlayerS ps = JsonMapper.ToObject <PlayerS>(jsonStr); string filePath = Application.dataPath + "/StreamingAssets" + "/PlayerInit.json"; //利用JsonMapper将信息类转化为Json格式的字符串 string saveJsonStr = JsonMapper.ToJson(ps); //创建一个文件流去将字符串写入一个文件夹中 StreamWriter sw = new StreamWriter(filePath); sw.WriteLine(saveJsonStr); sw.Close(); }
void SlashAttack(PlayerS target) { if (!target.effectPause){ CameraShakeS.C.SmallShake(); //CameraShakeS.C.TimeSleep(0.1f); Vector3 spawnPos = target.transform.position; spawnPos.z -= 1f; GameObject newSlash = Instantiate(slashObj, spawnPos, Quaternion.identity) as GameObject; newSlash.GetComponent<MaskSlashObjS>().targetPlayer = target; target.PauseCharacter(); } }
public void Update(GameTime gameTime, Game1 game, List <PlayerS> playerlist, List <Bullet> bulletlist) { pre_shot_timer += (float)gameTime.ElapsedGameTime.TotalSeconds; body.ResetDynamics(); PlayerS tmp = playerlist[0]; float MIN_distance = 1500; // находим наиближайшего персонажа foreach (var player in playerlist) { Vector2 Player_Position = ConvertUnits.ToDisplayUnits(player.body.Position + ConvertUnits.ToSimUnits(new Vector2(player.texture.Width / 2, player.texture.Height / 2))); Vector2 Mob_Position = ConvertUnits.ToDisplayUnits(body.Position); double formDistance = (double)((Player_Position.X - Mob_Position.X) * (Player_Position.X - Mob_Position.X) + (Player_Position.Y - Mob_Position.Y) * (Player_Position.Y - Mob_Position.Y)); float distance = (float)Math.Sqrt((double)formDistance); if (distance < MIN_distance && distance < distance_Min) { MIN_distance = distance; tmp = player; } } if (MIN_distance != 1500) { //поворот к игроку rotation_Plyer(tmp); // выстрел if (pre_shot_timer >= 0.3f) { var _bullet = bullet.Clone() as Bullet; _bullet.rotation = body.Rotation; _bullet.body.Rotation = body.Rotation; _bullet.body.Position = body.Position; bulletlist.Add(_bullet); pre_shot_timer = 0; } } else { //обнуление таймера pre_shot_timer = 0; } }
public void rotation_Plyer(PlayerS player) { Vector2 Player_position = ConvertUnits.ToDisplayUnits(player.body.Position); Vector2 direction = Player_position - ConvertUnits.ToDisplayUnits(body.Position); direction.Normalize(); rotation = (float)Math.Atan2((double)direction.Y, (double)direction.X); if (Math.Abs(rotation - body.Rotation) > MathHelper.ToRadians(180)) { if (rotation > body.Rotation) { rotation -= MathHelper.ToRadians(360); } else { rotation += MathHelper.ToRadians(360); } } if (body.Rotation > MathHelper.ToRadians(360)) { body.Rotation -= MathHelper.ToRadians(360); } if (body.Rotation < MathHelper.ToRadians(0)) { body.Rotation += MathHelper.ToRadians(360); } if (rotation > body.Rotation) { body.Rotation += MathHelper.ToRadians(speed_rotation); } if (rotation < body.Rotation) { body.Rotation -= MathHelper.ToRadians(speed_rotation); } }
public void Move(int palyaW, int palyaH, Direction irany) { elozoIrany = irany; if (irany == Direction.Up && PlayerS.Area.Top - speed >= 0) { PlayerS.ChangeY(-speed); } else if (irany == Direction.Down && PlayerS.Area.Bottom + speed <= palyaH) { PlayerS.ChangeY(speed); } else if (irany == Direction.Left && PlayerS.Area.Left - speed >= 0) { PlayerS.ChangeX(-speed); } else if (irany == Direction.Right && PlayerS.Area.Right + speed <= palyaW) { PlayerS.ChangeX(speed); } else if (irany == Direction.UpRight && PlayerS.Area.Right + speed <= palyaW && PlayerS.Area.Top <= palyaH) { PlayerS.ChangeX(speed / 2); PlayerS.ChangeY(-speed / 2); } else if (irany == Direction.Upleft && PlayerS.Area.Left - speed >= 0 && PlayerS.Area.Top <= palyaH) { PlayerS.ChangeX(-speed / 2); PlayerS.ChangeY(-speed / 2); } else if (irany == Direction.Downleft && PlayerS.Area.Left - speed >= 0 && PlayerS.Area.Bottom >= 0) { PlayerS.ChangeX(-speed / 2); PlayerS.ChangeY(speed / 2); } else if (irany == Direction.DownRight && PlayerS.Area.Right + speed <= palyaW && PlayerS.Area.Bottom >= 0) { PlayerS.ChangeX(speed / 2); PlayerS.ChangeY(speed / 2); } }
public void Update(GameTime gameTime, Game1 game, List <PlayerS> playerlist) { if (player_ID != "") { move_to_playe_ID(playerlist); if (player_ID != "") { return; } } PlayerS tmp = playerlist[0]; float MIN_distance = 2000; // находим наиближайшего персонажа foreach (var player in playerlist) { Vector2 Player_Position = ConvertUnits.ToDisplayUnits(player.body.Position); Vector2 Mob_Position = ConvertUnits.ToDisplayUnits(body.Position); double formDistance = (double)((Player_Position.X - Mob_Position.X) * (Player_Position.X - Mob_Position.X) + (Player_Position.Y - Mob_Position.Y) * (Player_Position.Y - Mob_Position.Y)); float distance = (float)Math.Sqrt((double)formDistance); if (distance < MIN_distance && distance < distance_Min && player_ID == "") { MIN_distance = distance; tmp = player; player_ID = player._id; } } if (MIN_distance != 2000) { //поворот к игроку rotation_Plyer(tmp); // движение к персонажу body.ResetDynamics(); body.ApplyLinearImpulse(new Vector2((float)Math.Sin(MathHelper.ToRadians(90) - body.Rotation) * 0.2f, (float)Math.Cos(MathHelper.ToRadians(90) - body.Rotation) * 0.2f)); } }
public void move_to_playe_ID(List <PlayerS> playerlist) { PlayerS tmp = playerlist[0]; foreach (var Player in playerlist) { if (Player._id == player_ID) { tmp = Player; } } if (tmp._id != player_ID)// если такого челика нет в списке { player_ID = ""; return; } // если челик есть, проверим расстояние Vector2 Player_Position = ConvertUnits.ToDisplayUnits(tmp.body.Position); Vector2 Mob_Position = ConvertUnits.ToDisplayUnits(body.Position); double formDistance = (double)((Player_Position.X - Mob_Position.X) * (Player_Position.X - Mob_Position.X) + (Player_Position.Y - Mob_Position.Y) * (Player_Position.Y - Mob_Position.Y)); float distance = (float)Math.Sqrt((double)formDistance); if (distance < distance_Min) { //поворот к игроку rotation_Plyer(tmp); // движение к персонажу body.ResetDynamics(); body.ApplyLinearImpulse(new Vector2((float)Math.Sin(MathHelper.ToRadians(90) - body.Rotation) * 0.2f, (float)Math.Cos(MathHelper.ToRadians(90) - body.Rotation) * 0.2f)); } else { player_ID = ""; return; } }
void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Player"){ if (other.gameObject.GetComponent<PlayerS>().playerNum == playerNum || playerNum == 5){ myPlayer = other.gameObject.GetComponent<PlayerS>(); GameObject newParticles = Instantiate(myPlayer.deathParticles,transform.position,Quaternion.identity) as GameObject; newParticles.GetComponent<ParticleSystem>().startColor = playerCols[myPlayer.characterNum-1]; // add to player score int numToAdd = Mathf.RoundToInt(myPlayer.health-myPlayer.initialHealth); //myPlayer.health = myPlayer.initialHealth; //print (numToAdd); if (numToAdd > 0){ myPlayer.initialHealth = myPlayer.health; myPlayer.score += numToAdd; myPlayer.GetComponent<TrailHandlerRedubS>().updateDots = true; } } } }
public void SelfDestruct(){ TurnOffIgnoreWalls(); UnpauseCharacter(); doingSpecial = false; specialTriggered = false; specialCooldown = 0; ownRigid.useGravity = true; TakeDamage(10000, false); if (pinkGrabbed != null){ pinkGrabbed.transform.parent = null; pinkGrabbed.TurnOffPinkPaused(); pinkGrabbed.TakeDamage(999999, true); pinkGrabbed = null; } }
void Start() { if (transform.parent){ playerRef = transform.parent.GetComponent<PlayerS>(); } else{ specialAttackDmg = true; } startPhysicsLayer = gameObject.layer; startSize = transform.localScale; ownColl = GetComponent<Collider>(); groundPoundSize = new Vector3(0.6f, 1.2f, 0.6f); laserAnimCountdown = laserAnimRate; }
public void PlayerDied(PlayerS p, bool hasMoreLives) { if(currentMode == 1) { if (!CurrentModeS.isTeamMode){ scoreBarObj.GetComponent<ScoreBar>().UpdateScoreboardStockMode(p); //Update Scorebar if ( !hasMoreLives ) //If Eliminated... { numPlayersLeft--; //Decrement counter playersPlaying[p.playerNum-1] = false; //Update list of remaining players print ("Player " + p.playerNum + " died!"); if (numPlayersLeft == 1) //If only one player remains left { for(int i = 0; i < 4 ; i ++) //Find Winner { if (playersPlaying[i] == true) winningPlayerNum = i + 1; //Record Winning Player Number } SpawnRoundEndScreen(); //Spawn End Screen } else{ print ("Number of players left: " + numPlayersLeft); } //end the game //SpawnEndScreen(); } else { //Update Scorebar ?? } } else{ // not in team mode if ( !hasMoreLives ) //If Eliminated... { if (GlobalVars.teamNumber[p.playerNum-1] == 1){ numPlayersRed--; } else{ numPlayersBlue--; } //Decrement counter playersPlaying[p.playerNum-1] = false; //Update list of remaining players print ("Player " + p.playerNum + " died!"); if (numPlayersRed == 0) //If only one player remains left { // BLUE TEAM WINS winningTeamNum = 2; SpawnRoundEndScreen(); //Spawn End Screen } else if (numPlayersBlue == 0) //If only one player remains left { // RED TEAM WINS winningTeamNum = 1; SpawnRoundEndScreen(); //Spawn End Screen } else{ print ("Number of players left: " + numPlayersLeft); } } } } }
// Use this for initialization void Start() { platformType = PlatformS.GetPlatform(); playerRef = transform.parent.GetComponent<PlayerS>(); playerRender = playerRef.spriteObject; transform.parent = null; startSize = transform.localScale.x; lv2Min = playerRef.GetChargeLv2Min(); lv3Min = playerRef.GetChargeLv3Min(); chargeBarSpriteRender = chargeBarSprite.GetComponent<SpriteRenderer>(); chargeBarSpriteRender.enabled = false; }
// Use this for initialization void Start() { parentObj = transform.parent.gameObject.GetComponent<PlayerS>(); //parentObj.buttObj = this; transform.parent = null; //parentObj.buttObj = this; //ownRender = GetComponentInChildren<SpriteRenderer>(); //headRender = parentObj.spriteObject.GetComponent<SpriteRenderer>(); }
// Update is called once per frame void LateUpdate() { if (ScoreKeeperS.gameEnd){ gameObject.SetActive(false); } if (!myPlayer){ if (GlobalVars.totalPlayers < playerNum){ gameObject.SetActive(false); } else{ myPlayer = GlobalVars.playerList[playerNum-1].GetComponent<PlayerS>(); if (playerNum == 1 || playerNum == 3){ charImage.sprite = charImagesLeft[GlobalVars.characterNumber[playerNum-1]-1]; } else{ charImage.sprite = charImages[GlobalVars.characterNumber[playerNum-1]-1]; } int numWins = 0; if (CurrentModeS.isTeamMode){ teamNum = GlobalVars.teamNumber[playerNum-1]; int teamWins = 0; if (teamNum == 1){ charCol = Color.red; teamWins = CurrentModeS.GetRedWins(); } else{ charCol = Color.blue; teamWins = CurrentModeS.GetBlueWins(); } charImage.color = charCol; numWins = teamWins; } else{ numWins = CurrentModeS.GetPlayerWins(playerNum); } if (numWins >= 1){ crown1.sprite = crownWon; } else{ crown1.sprite = crownLost; } if (numWins >= 2){ crown2.sprite = crownWon; } else{ crown2.sprite = crownLost; } crown3.sprite = crownLost; } } else{ //charImage.sprite = playerSprite.sprite; textDisplay.text = "P" + playerNum; if (myPlayer.numLives == 0){ textDisplay.text += ": " + " OUT"; } else{ if (!CurrentModeS.isTeamMode){ // ecto if (CurrentModeS.currentMode == 0){ int collectPercent = Mathf.RoundToInt (100*(myPlayer.health-myPlayer.startEctoNum)/ScoreKeeperS.scoreThresholdCollectoplaza); if (collectPercent > 100){ collectPercent = 100; } textDisplay.text += ": " + collectPercent + "%"; } // stock if (CurrentModeS.currentMode == 1){ textDisplay.text += ": " + (myPlayer.numLives); } // ball mode if (CurrentModeS.currentMode == 2){ //textDisplay.text += ": " + (100*myPlayer.score/ScoreKeeperS.scoreThresholdGhostball); textDisplay.text += ": " + myPlayer.score; } } else{ // team mode stuff if (CurrentModeS.currentMode == 0){ int collectPercent = Mathf.RoundToInt (100*(myPlayer.health-myPlayer.startEctoNum)/ScoreKeeperS.scoreThresholdCollectoplaza); if (collectPercent > 100){ collectPercent = 100; } textDisplay.text += ": " + collectPercent + "%"; } // stock if (CurrentModeS.currentMode == 1){ textDisplay.text += ": " + (myPlayer.numLives); } // ball mode if (CurrentModeS.currentMode == 2){ float currentScore = 0; if (teamNum == 1){ currentScore = scoreKeeper.GetRedScore(); } if (teamNum == 2){ currentScore = scoreKeeper.GetBlueScore(); } textDisplay.text += ": " + currentScore; } } } } }
public void SetPinkHold(PlayerS pinkTarget){ if (pinkGrabbed == null){ pinkGrabbed = pinkTarget; pinkGrabbed.transform.parent = transform; pinkTarget.TurnOnPinkPause(); } }
// Use this for initialization void Start() { playerRef = GetComponent<PlayerS>(); playerRef.soundSource = this; characterNum = playerRef.characterNum; }
public void UpdateScoreboardStockMode(PlayerS p) { //do things? print("Updating Scoreboard for Stock Mode"); }
void FixedUpdate() { // this is to fix a bug with damage obj not finding its own reference if (!specialAttackDmg){ if (playerRef == null){ playerRef = transform.parent.GetComponent<PlayerS>(); } else{ // increase in size for lv3, reset otherwise if (playerRef.attacking && playerRef.attackToPerform == 2){ transform.localScale = startSize*collSizeMult; } else if (playerRef.groundPounded){ transform.localScale = groundPoundSize; } else{ transform.localScale = startSize; } if (playerRef.isDangerous){ ownColl.enabled = true; } else{ ownColl.enabled = false; } } if (gameObject.layer != startPhysicsLayer){ gameObject.layer = startPhysicsLayer; } } else{ if (myLaserRender){ LaserHandler(); } } }
public void SpecialIsDoneAnimating(){ specialTriggered = true; // do special stuff // if ghostMask, execute attack immediately if (characterNum == 1){ GameObject specialAttack = Instantiate(ghostMaskSpecialPrefab, transform.position, Quaternion.identity) as GameObject; specialAttack.GetComponent<GhostMaskSpecialAttackS>().playerRef = this; } // if acid, prep for DEATH LASER if (characterNum == 2){ specialCooldown = acidSpecialTimeMax; acidSpecialReference = Instantiate(acidSpecialCollider, transform.position, Quaternion.identity) as GameObject; acidSpecialReference.GetComponent<DamageS>().MakeSpecial(this); acidSpecialCurrentRotateRate = acidSpecialStartRotateRate; // face input dir Vector3 inputDir = Vector3.zero; #if UNITY_WIIU if (playerNum == 1){ inputDir.x = Input.GetAxis("HorizontalPlayer" + playerNum + platformType); inputDir.y = Input.GetAxis("VerticalPlayer" + playerNum + platformType); } else{ inputDir.x = wiiUInput.horizontalAxis; inputDir.y = wiiUInput.verticalAxis; } #else inputDir.x = Input.GetAxis("HorizontalPlayer" + playerNum + platformType); inputDir.y = Input.GetAxis("VerticalPlayer" + playerNum + platformType); #endif spriteObject.GetComponent<PlayerAnimS>().FaceTargetInstant(inputDir); // rotate a tiny bit to allow for error if (spriteObject.transform.localScale.x < 0){ spriteObject.transform.Rotate(new Vector3(0,0, 60f)); Debug.Log(spriteObject.transform.rotation); } else{ spriteObject.transform.Rotate(new Vector3(0,0, -60f)); Debug.Log(spriteObject.transform.rotation); } currentLerpTarget = spriteObject.transform.rotation.eulerAngles.z; } // if mummy, prep for shots if (characterNum == 3){ timeBettwenProjCountdown = timeBetweenProjsMax; currentProj = 0; specialCooldown = 1; // face input dir Vector3 inputDir = Vector3.zero; #if UNITY_WIIU if (playerNum == 1){ inputDir.x = Input.GetAxis("HorizontalPlayer" + playerNum + platformType); inputDir.y = Input.GetAxis("VerticalPlayer" + playerNum + platformType); } else{ inputDir.x = wiiUInput.horizontalAxis; inputDir.y = wiiUInput.verticalAxis; } #else inputDir.x = Input.GetAxis("HorizontalPlayer" + playerNum + platformType); inputDir.y = Input.GetAxis("VerticalPlayer" + playerNum + platformType); #endif if (inputDir.x == 0 && inputDir.y == 0){ inputDir.x = 1f; if (spriteObject.transform.localScale.x > 0){ inputDir *= -1f; } } spriteObject.GetComponent<PlayerAnimS>().FaceTargetInstant(inputDir); if (spriteObject.transform.localScale.x < 0){ currentLerpTarget = spriteObject.transform.rotation.eulerAngles.z+30f; } else{ currentLerpTarget = spriteObject.transform.rotation.eulerAngles.z-30f; } } if (characterNum == 4){ effectPause = false; specialCooldown = 1; GameObject specialAttack = Instantiate(pinkWhipSpecialPrefab, transform.position, transform.rotation) as GameObject; specialAttack.transform.parent = transform; specialAttack.GetComponent<PinkWhipSpecialAttackS>().playerRef = this; // shoot off in dir Vector3 inputDir = Vector3.zero; #if UNITY_WIIU if (playerNum == 1){ inputDir.x = Input.GetAxis("HorizontalPlayer" + playerNum + platformType); inputDir.y = Input.GetAxis("VerticalPlayer" + playerNum + platformType); } else{ inputDir.x = wiiUInput.horizontalAxis; inputDir.y = wiiUInput.verticalAxis; } #else inputDir.x = Input.GetAxis("HorizontalPlayer" + playerNum + platformType); inputDir.y = Input.GetAxis("VerticalPlayer" + playerNum + platformType); #endif if (inputDir.x == 0 && inputDir.y == 0){ inputDir.x = 1f; if (spriteObject.transform.localScale.x > 0){ inputDir *= -1f; } } pinkWhipSpecialVel = inputDir.normalized*pinkWhipSpecialSpeed; ownRigid.velocity = pinkWhipSpecialVel*Time.deltaTime; pinkPaused = false; pinkGrabbed = null; pinkWhipSuplexCurrentSpeed = pinkWhipSuplexStartSpeed; TurnOnIgnoreWalls(); } // character 5 does vertical chomp if (characterNum == 5){ GameObject SpecialAttackChar5 = Instantiate(char5SpecialHandler, transform.position, Quaternion.identity) as GameObject; SpecialAttackChar5.GetComponent<MegaChompHandlerS>().playerRef = this; specialCooldown = 1f; } // character 6 (unnamed for now) destroys self with explosion after small delay if (characterNum == 6){ blobbySpecialDelay = blobbySpecialDelayMax; } }
public void MakeSpecial(PlayerS newRef, MegaChompHandlerS mega) { specialAttackDmg = true; playerRef = newRef; if (playerRef.characterNum == 2){ // activate laser visual myLaserRender = GetComponent<LineRenderer>(); myLaserRender.enabled = true; } if (!ownColl){ ownColl = GetComponent<Collider>(); } ownColl.enabled = true; megaRef = mega; }