public void StopSound(CharacterSound type, float fadeInSeconds = 0.5f) { if (_sounds[(int)type].isPlaying) { Timing.RunCoroutine(_fadeSound(fadeInSeconds, (int)type)); } }
void Start() { ChatBubble.Create(transform, new Vector3(0.5f, 0.5f), sentence, 7f); CharacterSound audio = transform.parent.GetComponentInChildren <CharacterSound>(); audio.PlayBlabla(); }
void Start() { control = GetComponent <Control> (); characterSound = GetComponent <CharacterSound> (); hurt = GameObject.Find("Hurt").GetComponent <FadeImage> (); gameBGM = GameObject.Find("Game").GetComponent <BGM> (); }
private void Awake() { _rb2D = GetComponent <Rigidbody2D>(); _spriteRenderer = GetComponent <SpriteRenderer>(); _animator = GetComponent <Animator>(); _speechBubble = GetComponent <SpeechBubble>(); _characterSound = GetComponent <CharacterSound>(); _blockInput = false; Messenger <InputType> .AddListener("PlayerInput", PlayerInput); }
protected void PlaySound(CharacterSound soundKey, ICharacter character) { ProtoCharacterSkeleton protoCharacterSkeleton; if (character.IsInitialized) { var clientState = GetClientState(character); protoCharacterSkeleton = clientState.CurrentProtoSkeleton; } else { this.SharedGetSkeletonProto(null, out var protoCharacterSkeleton1, out _); protoCharacterSkeleton = (ProtoCharacterSkeleton)protoCharacterSkeleton1; } protoCharacterSkeleton.PlaySound(soundKey, character); }
void Start() { characterController = GetComponent <CharacterController> (); character = GetComponent <Character> (); cameraTransform = transform.Find("Camera"); GameObject sniperObject = transform.Find("Camera/sniper").gameObject; sniper = sniperObject.GetComponent <Gun> (); sniperSight = sniperObject.GetComponent <Sight> (); GameObject submachineObject = transform.Find("Camera/submachinegun").gameObject; submachineGun = submachineObject.GetComponent <Gun> (); activeGun = sniper; inactiveGun = submachineGun; characterSound = GetComponent <CharacterSound> (); game = GameObject.Find("Game").GetComponent <Game> (); gameUIPanel = GameObject.Find("GameUI").GetComponent <GameUIPanel> (); }
public void ServerPlaySound(ICharacter characterNpc, CharacterSound characterSound) { using var observers = Api.Shared.GetTempList <ICharacter>(); if (characterSound != CharacterSound.Aggression) { ServerWorld.GetScopedByPlayers(characterNpc, observers); } else { // this event is propagated on a larger distance and has sound cues ServerWorld.GetCharactersInRadius(characterNpc.TilePosition, observers, radius: this.SoundEventsNetworkRadius, onlyPlayers: true); } this.CallClient(observers.AsList(), _ => _.ClientRemote_PlaySound(characterNpc, characterNpc.TilePosition, characterSound)); }
public void PlaySound(CharacterSound soundKey, ICharacter character) { var(soundPresetCharacter, soundPresetMovement) = this.GetSoundPresets(character); soundPresetCharacter.PlaySound(soundKey, character); soundPresetMovement.PlaySound(soundKey, character); }
public void PlaySound(CharacterSound type) { _sounds[(int)type].Play(); }
protected void PlaySound(CharacterSound soundKey, ICharacter character) { var clientState = GetClientState(character); clientState.CurrentProtoSkeleton.PlaySound(soundKey, character); }
public static Character Read(BinaryReader br, uint dataStart) { Character result = new Character(); long startPos = br.BaseStream.Position; result.Type = (CharacterType)br.ReadUInt32(); result.Signature = br.ReadUInt32(); result.Unknown1 = br.ReadUInt16(); result.ID = br.ReadUInt16(); result.Unknown2 = br.ReadUInt32(); switch (result.Type) { case CharacterType.Shape: CharacterShape shape = new CharacterShape(); shape.Bounds = br.ReadRectF(); shape.GeometryID = br.ReadUInt32(); result.Data = shape; break; case CharacterType.EditText: CharacterTextEdit textEdit = new CharacterTextEdit(); textEdit.Bounds = br.ReadRectF(); textEdit.FontID = br.ReadUInt32(); textEdit.Alignment = (TextAlignment)br.ReadUInt32(); textEdit.Color = br.ReadUInt32(); textEdit.FontHeight = br.ReadSingle(); textEdit.ReadOnly = br.ReadUInt32(); textEdit.Multiline = br.ReadUInt32(); textEdit.Wordwrap = br.ReadUInt32(); uint textPtr = dataStart + br.ReadUInt32(); uint variableNamePtr = dataStart + br.ReadUInt32(); long thePos = br.BaseStream.Position; br.BaseStream.Position = textPtr; textEdit.Text = br.ReadCStr(); br.BaseStream.Position = variableNamePtr; textEdit.Variable = br.ReadCStr(); br.BaseStream.Position = thePos; result.Data = textEdit; break; case CharacterType.Font: CharacterFont font = new CharacterFont(); uint namePtr = dataStart + br.ReadUInt32(); long cPos = br.BaseStream.Position; br.BaseStream.Position = namePtr; font.Name = br.ReadCStr(); br.BaseStream.Position = cPos; uint glyphCount = br.ReadUInt32(); uint glyphPtr = br.ReadUInt32(); cPos = br.BaseStream.Position; br.BaseStream.Position = dataStart + glyphPtr; font.Glyphs = new Character[glyphCount]; for (int i = 0; i < font.Glyphs.Length; i++) { font.Glyphs[i] = Character.Read(br, dataStart); } br.BaseStream.Position = cPos; result.Data = font; break; case CharacterType.Button: CharacterButton button = new CharacterButton(); button.MenuButton = br.ReadUInt32(); button.Bounds = br.ReadRectF(); button.TriangleCount = br.ReadInt32(); button.VertexCount = br.ReadInt32(); button.VertexPtr = br.ReadUInt32(); button.TrianglePtr = br.ReadUInt32(); button.RecordCount = br.ReadInt32(); button.RecordPtr = br.ReadUInt32(); button.ActionCount = br.ReadInt32(); button.ActionPtr = br.ReadUInt32(); button.SoundPtr = br.ReadUInt32(); result.Data = button; break; case CharacterType.Sprite: CharacterSprite sprite = new CharacterSprite(); uint frameCount2 = br.ReadUInt32(); uint framePtr2 = br.ReadUInt32(); sprite.Unknown1 = br.ReadUInt32(); // TODO: Verify Frames br.BaseStream.Position = dataStart + framePtr2; sprite.Frames = new Frame[frameCount2]; for (int i = 0; i < sprite.Frames.Length; i++) { sprite.Frames[i] = ReadFrame(br, dataStart); } result.Data = sprite; break; case CharacterType.Sound: CharacterSound sound = new CharacterSound(); // TODO: Sound result.Data = sound; break; case CharacterType.Image: CharacterImage image = new CharacterImage(); image.ImageID = br.ReadUInt32(); // TODO: Verify result.Data = image; break; case CharacterType.Morph: CharacterMorph morph = new CharacterMorph(); // TODO: Morph result.Data = morph; break; case CharacterType.Movie: CharacterMovie movie = new CharacterMovie(); uint frameCount = br.ReadUInt32(); uint framePtr = br.ReadUInt32(); movie.Unknown1 = br.ReadUInt32(); uint characterCount = br.ReadUInt32(); uint characterPtr = br.ReadUInt32(); movie.ScreenWidth = br.ReadInt32(); movie.ScreenHeight = br.ReadInt32(); movie.MillisecondsPerFrame = br.ReadInt32(); uint importCount = br.ReadUInt32(); uint importPtr = br.ReadUInt32(); uint exportCount = br.ReadUInt32(); uint exportPtr = br.ReadUInt32(); movie.Unknown2 = br.ReadUInt32(); //MessageBox.Show("Pos: " + br.BaseStream.Position.ToString("X8")); //MessageBox.Show("Pos: " + characterPtr.ToString("X8")); long myPos = br.BaseStream.Position; br.BaseStream.Position = dataStart + framePtr; movie.Frames = new Frame[frameCount]; for (int i = 0; i < movie.Frames.Length; i++) { movie.Frames[i] = ReadFrame(br, dataStart); } br.BaseStream.Position = dataStart + characterPtr; uint[] CharacterPtrs = new uint[characterCount]; for (int i = 0; i < characterCount; i++) { CharacterPtrs[i] = dataStart + br.ReadUInt32(); } movie.Characters = new Character[characterCount]; for (int i = 0; i < movie.Characters.Length; i++) { if (CharacterPtrs[i] == startPos) { movie.Characters[i] = result; } else { br.BaseStream.Position = CharacterPtrs[i]; movie.Characters[i] = Character.Read(br, dataStart); } } br.BaseStream.Position = dataStart + importPtr; movie.Imports = new Import[importCount]; for (int i = 0; i < movie.Imports.Length; i++) { Import import = new Import(); uint importMoviePtr = dataStart + br.ReadUInt32(); uint importNamePtr = dataStart + br.ReadUInt32(); import.CharacterID = br.ReadInt32(); import.Unknown1 = br.ReadUInt32(); long pos = br.BaseStream.Position; br.BaseStream.Position = importMoviePtr; import.ImportMovie = br.ReadCStr(); br.BaseStream.Position = importNamePtr; import.ImportName = br.ReadCStr(); br.BaseStream.Position = pos; movie.Imports[i] = import; } br.BaseStream.Position = dataStart + exportPtr; movie.Exports = new Export[exportCount]; for (int i = 0; i < movie.Exports.Length; i++) { Export export = new Export(); uint exportNamePtr = dataStart + br.ReadUInt32(); export.CharacterID = br.ReadInt32(); long pos = br.BaseStream.Position; br.BaseStream.Position = exportNamePtr; export.ExportName = br.ReadCStr(); br.BaseStream.Position = pos; movie.Exports[i] = export; } br.BaseStream.Position = myPos; // TODO: Init Arrays result.Data = movie; break; case CharacterType.StaticText: CharacterStaticText staticText = new CharacterStaticText(); // TODO: Static Text result.Data = staticText; break; case CharacterType.None: break; case CharacterType.Video: CharacterVideo video = new CharacterVideo(); // TODO: Video result.Data = video; break; default: MessageBox.Show("Out of range Character Type: " + result.Type); break; } // TODO: Finish Read return(result); }
void Start() { m_playerState = PlayerState.Idle; m_rgbd = GetComponent<Rigidbody2D>(); m_boxColl = GetComponent<BoxCollider2D>(); m_FacingRight = true; m_Animator = GetComponentInChildren<Animator>(); m_SelectedAmmo = Ammo.PushWave; m_Pv = 3; m_MaxPV = 3; m_IsVulnerable = true; m_IsShooting = false; m_RendList = gameObject.GetComponentsInChildren<SpriteRenderer>(true); m_Sound = GetComponent<CharacterSound>(); }
void Awake() { Vector2 objPosition = this.transform.position; Rect objRect = this.gameObject.GetComponent <RectTransform>().rect; objectGroup = this.transform.Find("Object"); uiGroup = this.transform.Find("UI"); rigidbody = this.GetComponent <Rigidbody2D>(); characterCollider = this.GetComponent <BoxCollider2D>(); animator = this.objectGroup.GetComponent <Animator>(); sound = this.objectGroup.GetComponent <CharacterSound>(); infomation = new Ability(); this.action = (int)CharacterAction.Normal; // base setting infomation.movementSpeed = 5f; infomation.runSpeed = 5f; infomation.jumpPower = 15.5f; infomation.maxJump = 2; direction = 1; infomation.power = 10; infomation.beforeDelay = 2.0f; infomation.afterDelay = 2.0f; infomation.energyPower = 5; infomation.healthPoint = 100; infomation.manaPoint = 50; currentHealthPoint = infomation.healthPoint; currentManaPoint = infomation.manaPoint; infomation.aggroRange = objRect.width; infomation.range = objRect.width * 2; beforeDelayActionStr = string.Empty; hpBar = uiGroup.Find("HPBar").GetComponent <ProgressBar>(); hpBar.init(currentHealthPoint, new Color(1, 0, 0)); buffList = new ArrayList(); skills = new ArrayList(); skills.Add(Skill.addSkill(this.gameObject, 17)); skills.Add(Skill.addSkill(this.gameObject, 2)); skills.Add(Skill.addSkill(this.gameObject, 18)); equipments = new Ability[5]; inventory = new ArrayList(); inventory.Add(new Item(inventory, 1)); inventory.Add(new Item(inventory, 1)); inventory.Add(new Item(inventory, 1)); for (int i = 0; i < 5; i++) { equipments[i] = new Ability(); } jumpClear(); }
private void Start() { characterSound = GetComponent <CharacterSound>(); }