private void Start() { // Retrieve the player avatar of the game object. this.playerAvatar = this.GetComponent <PlayerAvatar>(); if (this.playerAvatar == null) { Debug.LogWarning("There is no player avatar on the game object."); } // Retrieve the engines of the game object. this.engines = this.GetComponent <Engines>(); if (this.engines == null) { Debug.LogWarning("There is no engines on the game object."); } // Retrieve the bullet guns of the game object. this.bulletGuns = this.GetComponents <BulletGun>(); if (this.bulletGuns == null || this.bulletGuns.Length == 0) { Debug.LogWarning("There is no bullet guns on the game object."); } }
public void Start() { myBase = GetComponent <PlayerAvatar>(); TypeTir = 0; UpdateTir(); lastShoot = 30; }
public async Task <MethodResult> SetPlayerAvatar() { PlayerAvatar avatar = new PlayerAvatar(); try { SetAvatarResponse response = await _client.Player.SetAvatar(avatar); LogCaller(new LoggerEventArgs("Avatar set to defaults", LoggerTypes.Success)); if (response.Status == SetAvatarResponse.Types.Status.Success) { return(new MethodResult { Success = true }); } return(new MethodResult()); } catch (Exception ex) { LogCaller(new LoggerEventArgs("Failed to set avatar", LoggerTypes.Exception, ex)); return(new MethodResult()); } }
//Receiving an avatar another user has made //Initialize our copy to have the same properties private void ProcessAvatarMake(AvatarInfo info) { Debug.Log("User Made Avatar, initializing"); Debug.Log("Avatar: " + "{playerID: " + info.playerID + ", viewID: " + info.viewID + ", spawnPosition: " + info.spawnPosition + ", color: " + info.color + "}"); PhotonView view = PhotonView.Find(info.viewID); if (view == null) { Debug.LogError("Error: No PhotonView Component!"); return; } PlayerAvatar newAvatar = view.GetComponent <PlayerAvatar>(); if (newAvatar == null) { Debug.LogError("Error: No PlayerAvatar Component!"); return; } newAvatar.Initialize(info, null, null); }
private void Start() { gameState = GameState.Play; Time.timeScale = 1; playerHasDied = false; this.levelDescriptions = XmlHelpers.DeserializeDatabaseFromXML <LevelDescription>(this.levelDescriptionXml); // Spawn the player. GameObject player = (GameObject)GameObject.Instantiate(Instance.playerPrefab, new Vector3(0f, 0f), Quaternion.identity); this.PlayerAvatar = player.GetComponent <PlayerAvatar>(); if (this.PlayerAvatar == null) { Debug.LogError("Can't retrieve the PlayerAvatar script."); } switch (gameType) { case GameType.Levels: currentLevel = new Level(); StarNextLevel(); break; case GameType.Endless: break; default: Debug.LogWarning("Unknown game type." + gameType.ToString()); break; } }
void InflateAnim(PlayerAvatar avatar) { var overrideController = Resources.Load <AnimatorOverrideController> ("OverrideControllers/" + WeaponName); avatar.anim.runtimeAnimatorController = overrideController; }
public async Task <SetAvatarResponse> SetAvatar(PlayerAvatar playerAvatar) { return(await PostProtoPayloadCommonR <Request, SetAvatarResponse>(RequestType.SetAvatar, new SetAvatarMessage() { PlayerAvatar = playerAvatar }).ConfigureAwait(false)); }
void Start() { avatar = GameManager.Instance.GetPlayer().GetComponent <PlayerAvatar>(); maxHealth = avatar.GetMaxHealth(); bulletGun = avatar.GetComponent <BulletGun>(); maxEnergy = bulletGun.GetMaxEnergy(); }
// Use this for initialization void Start() { //On instantie le joueur PlayerAvatar temp = Instantiate(player); //On prépare l'événemment de fin de jeu temp.OnPlayerDeath += OnGameOver; //On calcule les dimensions de la fenetre de jeu height = Camera.main.orthographicSize; width = height * Camera.main.aspect; //On crée le décor for (int i = 0; (i - 2) * 20.48 < width; i++) { Instantiate(background, new Vector3(i * 20.48f + 10.24f - width, 0, 1), transform.rotation); } //On modifie ces valeurs pour assurer que les ennemis sont créés hors de la fenetre height -= enemy.GetComponent <Renderer> ().bounds.size.x / 2f; width += enemy.GetComponent <Renderer> ().bounds.size.y / 2f; //On initialise le temps pour créer les ennemis timeOfNextEnemyInstantiation = Time.time; //WriteDataInXML ("test_data2.xml"); //à ignorer, j'avais juste la flemme d'écrire un XML à la main if (levelTextAsset) { LoadFromXML(levelTextAsset); } }
private async Task <MethodResult> SetPlayerAvatar() { var avatar = new PlayerAvatar(); var response = await _client.ClientSession.RpcClient.SendRemoteProcedureCallAsync(new Request { RequestType = RequestType.SetAvatar, RequestMessage = new SetAvatarMessage { PlayerAvatar = avatar }.ToByteString() }, true, true, true); if (response == null) { return(new MethodResult()); } SetAvatarResponse setAvatarResponse = null; setAvatarResponse = SetAvatarResponse.Parser.ParseFrom(response); LogCaller(new LoggerEventArgs("Avatar set to defaults", LoggerTypes.Success)); return(new MethodResult { Success = true }); }
void OnTriggerEnter2D(Collider2D other) { //Au contact du personnage, on applique les effets du collectable PlayerAvatar target = other.GetComponent <PlayerAvatar> (); if (target) { GameManager gameManager = GameObject.FindObjectOfType <GameManager> (); if (gameManager) { if (gameManager.GameModeWithHealth) { target.TakeDamage(-healthRecovery); Destroy(gameObject); } if (!gameManager.GameModeWithHealth) { gameManager.BoostCombo(comboBoost); Destroy(gameObject); } } BulletGun bulletGun = other.GetComponent <BulletGun> (); if (bulletGun && unlockNextShoot) { bulletGun.TryUnlockNextShoot(); } if (bulletGun && energyRecovery) { bulletGun.RefillEnergy(); } } }
private void Initialize() { CurrentState = State.Idle; _avatarCtrl = AvatarController.GetInstance(); _avatar = _avatarCtrl.Avatar; _avatar.OnSuccsefulEating += () => { Score += 1; }; _avatar.OnDeath += DeathHandler; _buildCtrl = BuildController.GetInstance(); _buildCtrl.SetMeteorController(); _taskCtrl = TaskController.GetInstance(); _taskCtrl.Avatar = _avatar; _taskCtrl.TaskCompleted += (ITask x) => Debug.Log(x); DuringDistanceTask.Avatar = _avatar.transform; _pursuitCtrl = PursuitController.GetInstance(); _pursuitCtrl.AvatarTf = _avatar.transform; _pursuitCtrl.Catched += CatchedHandler; _idGen = new IDGenerator(); _stuff = new SortedDictionary <int, GameObject>(); _mainProvider = new MultiGeneratorProvider(_stuff, _pursuitCtrl, _idGen); _mainProvider.SetIDGenerator(_idGen); _firstCarPos = new Vector2(0, 1); _firstCarDesc = new CarDescriptor(_firstCarPos, 0, 1); _playStats = new PlayStatistics(); _globStats = GlobalStatistics.GetInstance(); // Vehicle.Avatar = _avatar; ProjectileGun.SetAvatar(_avatar); _isInitialized = true; }
void Awake() { playerAvatar = GameObject.FindWithTag("Player").GetComponent <PlayerAvatar>(); size = GetComponent <BoxCollider2D>().size.x *transform.localScale.x; GetComponent <BoxCollider2D>().enabled = false; // engines = player.GetComponent<Engines>(); }
public async Task <MethodResult> ListAvatarCustomizations() { try { var avatar = new PlayerAvatar(); var response = await _client.ClientSession.RpcClient.SendRemoteProcedureCallAsync(new Request { RequestType = RequestType.ListAvatarCustomizations, RequestMessage = new ListAvatarCustomizationsMessage { Filters = { Filter.Default } }.ToByteString() }, true, true, true); var parsedResponse = ListAvatarCustomizationsResponse.Parser.ParseFrom(response); LogCaller(new LoggerEventArgs("ListAvatarCustomizations set to defaults", LoggerTypes.Success)); return(new MethodResult { Success = true }); } catch (Exception ex) { LogCaller(new LoggerEventArgs("Failed to set avatar", LoggerTypes.Exception, ex)); return(new MethodResult()); } }
private string getDeathStatusText(PlayerAvatar avatar) { var name = avatar.Name; var msg = DeathStatusMessages[new Random().Next(DeathStatusMessages.Length)]; return(msg.Replace("NAME", name)); }
public MoveAction(Turn turn) { this.turn = turn; avatar = turn.Owner.avatar; Point = avatar.transform.position; }
IEnumerator AnimatePotion(PotionType potionType) { PlayerAvatar avatar = CurrentPlayer.PlayerAvatar; Sprite potionSprite = CardTextures.PotionSpriteLookup[potionType]; avatar.PotionSprite = potionSprite; avatar.ShowPotionImage = true; switch (potionType) { case PotionType.FrekenKraken: yield return(AnimateFrekenKrakenCR()); break; case PotionType.TemptressShield: yield return(AnimateTemptressShieldCR()); break; case PotionType.BasicSword: yield return(AnimateBasicSwordCR()); break; } avatar.ShowPotionImage = false; }
public async Task <MethodResult> SetPlayerAvatar() { PlayerAvatar avatar = new PlayerAvatar(); var response = await _client.ClientSession.RpcClient.SendRemoteProcedureCallAsync(new Request { RequestType = RequestType.SetAvatar, RequestMessage = new SetAvatarMessage { PlayerAvatar = avatar }.ToByteString() }); SetAvatarResponse setAvatarResponse = null; try { setAvatarResponse = SetAvatarResponse.Parser.ParseFrom(response); LogCaller(new LoggerEventArgs("Avatar set to defaults", LoggerTypes.Success)); return(new MethodResult { Success = true }); } catch (Exception ex) { if (response.IsEmpty) { LogCaller(new LoggerEventArgs("Failed to set avatar", LoggerTypes.Exception, ex)); } return(new MethodResult()); } }
public async Task <SetAvatarResponse> SetAvatar(PlayerAvatar playerAvatar) { var setAvatarRequest = new Request { RequestType = RequestType.SetAvatar, RequestMessage = new SetAvatarMessage { PlayerAvatar = playerAvatar }.ToByteString() }; var request = await GetRequestBuilder().GetRequestEnvelope(CommonRequest.FillRequest(setAvatarRequest, Client)).ConfigureAwait(false); Tuple <SetAvatarResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse> response = await PostProtoPayload <Request, SetAvatarResponse, CheckChallengeResponse, GetHatchedEggsResponse, GetInventoryResponse, CheckAwardedBadgesResponse, DownloadSettingsResponse, GetBuddyWalkedResponse>(request).ConfigureAwait(false); CheckChallengeResponse checkChallengeResponse = response.Item2; CommonRequest.ProcessCheckChallengeResponse(Client, checkChallengeResponse); GetInventoryResponse getInventoryResponse = response.Item4; CommonRequest.ProcessGetInventoryResponse(Client, getInventoryResponse); DownloadSettingsResponse downloadSettingsResponse = response.Item6; CommonRequest.ProcessDownloadSettingsResponse(Client, downloadSettingsResponse); return(response.Item1); }
/// <summary> /// Update the specified dt. /// </summary> /// <param name="dt">Dt.</param> public override void Update(float dt) { Vector2 movementVector = Vector2.zero; movementVector.x = Util.Sign(Input.GetAxis(horizontalMoveAxis)); movementVector.y = Util.Sign(Input.GetAxis(verticalMoveAxis)); //Debug.Log (horizontalMoveAxis + " : " + Input.GetAxis (horizontalMoveAxis)); //Debug.Log ("movement vector: " + movementVector.ToString ()); bool focus = Input.GetButton(focusButton); bool fire = Input.GetButton(fireButton); bool charge = Input.GetButton(chargeButton); PlayerAvatar.Move(movementVector.x, movementVector.y, focus, dt); if (fire) { PlayerAvatar.StartFiring(); } else { PlayerAvatar.StopFiring(); } if (charge) { PlayerAvatar.StartCharging(); } else if (PlayerAvatar.CurrentChargeLevel != 0) { PlayerAvatar.ReleaseCharge(); } }
public void TakeDamage(int amount, GameObject source) { takeDamageSound.Play(); this.hitpoints -= amount; if (this.hitpoints <= 0) { dieSound.Play(); // Die! this.humanPlayer.AddDeath(); StartCoroutine(scheduleForDestruction()); // Give a kill to whoever pwn'd this player PlayerAvatar killer = source.GetComponent <PlayerAvatar>(); if (killer != null) { killer.humanPlayer.AddKill(); } Projectile projectileKiller = source.GetComponent <Projectile>(); if (projectileKiller != null) { projectileKiller.GetOwner().humanPlayer.AddKill(); } } }
public Player(int id, PlayerData playerData) { if (playerData == null) { return; } m_playerData = playerData; m_id = id; GameResModuel resModuel = GameStart.GetInstance().ResModuel; GameObject player = resModuel.LoadResources <GameObject>(EResourceType.Role, playerData.m_playerResPath); player = CommonFunc.Instantiate(player); if (player != null) { player.name = playerData.m_playerName; m_avatar = player.AddComponent <PlayerAvatar>(); m_anim = new PlayerAnim(player); m_anim.InitAnimator(playerData.m_animControllerName); GameObject collider = CommonFunc.GetChild(player, "Collider"); m_collider = new PlayerCollider(playerData.m_moveArea, playerData.m_radius, playerData.m_angle, collider.GetComponent <BoxCollider2D>()); MovePosition(m_playerData.m_bornPosition); } }
public PushAnim(Texture2D image, PlayerAvatar pusher, Vector2 offset, Point destination) { this.image = image; this.pusher = pusher; pushOffset = offset; destinationGridPos = destination; }
public SetAvatarResponse SetAvatar(PlayerAvatar playerAvatar) { return(PostProtoPayload <Request, SetAvatarResponse>(RequestType.SetAvatar, new SetAvatarMessage() { PlayerAvatar = playerAvatar })); }
void Awake() { // Check if null in prod... engines = GetComponent <Engines>(); playerAvatar = GetComponent <PlayerAvatar>(); bulletGun = GetComponent <BulletGun>(); }
public async Task <SetAvatarResponse> SetAvatar(PlayerAvatar playerAvatar) { return(await PostProtoPayload <Request, SetAvatarResponse>(RequestType.SetAvatar, new SetAvatarMessage() { PlayerAvatar = playerAvatar })); }
void Start() { _player = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerAvatar>(); _maxHealth = _player.MaxHealth; _maxEnergy = _player.Energy; _scoreText.text = "000"; }
void Awake() { inst = this; animator = GetComponent <Animator>(); collider = GetComponent <CapsuleCollider>(); delay = new WaitForSeconds(respawnDelay); gameController = FindObjectOfType <GameController>(); }
void Awake() { body = GetComponent <Rigidbody>(); world = pipeSystem.transform.parent; rotater = transform.GetChild(0); avatar = rotater.GetChild(0).GetComponent <PlayerAvatar>(); gameObject.SetActive(false); }
public override void OnPlayerUnselected(PlayerAvatar player) { if (selectedPlayer == player) { Destroy(target); selectedPlayer = null; } }
private void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.CompareTag("Player")) { PlayerAvatar playerAvatar = other.gameObject.GetComponent <PlayerAvatar>(); playerAvatar.Hurt(damage); GetComponent <BaseAvatar>().Hurt(1000000); } }
public async Task<SetAvatarResponse> SetAvatar(PlayerAvatar playerAvatar) { return await PostProtoPayload<Request, SetAvatarResponse>(RequestType.SetAvatar, new SetAvatarMessage() { PlayerAvatar = playerAvatar }); }
void Awake(){ instance = this; }
void SetupPlayer() { playerAvatarInstance = gameObject.AddComponent<PlayerAvatar>(); }