protected override void SetInitialValues() { _animatorVariables = new PlayerAnimatorVariables(); _cinemachine = GameObject.FindObjectOfType <CinemachineVirtualCamera>(); _uIManager = GameObject.FindObjectOfType <UIManager>(); _playerStateManage = GameObject.FindObjectOfType <PlayerStateManager>(); _activePlayerUI = GameObject.FindObjectOfType <ActivePlayersUIComponent>(); _animator = this.GetComponent <Animator>(); _audioComponent = this.GetComponent <AudioComponent>(); _damageDealerComponent = this.GetComponent <DamageDealerComponent>(); _damageTakerComponent = this.GetComponent <DamageTakerComponent>(); _miniMapComponent = GameObject.FindObjectOfType <MiniMapComponent>(); if (_canMoveByClick) { _movementMouseComponent = this.GetComponent <MovementMouseComponent>(); } if (_canInteract) { _interactableComponent = this.GetComponent <InteractableComponent>(); } if (_canPoop) { _stomachComponent = this.GetComponent <StomachComponent>(); } }
public void Anim_SpawnPoop() { GameObject gameObject = Instantiate(_genericPoopComponent, _spawnSpot.position, Quaternion.identity); gameObject.GetComponent <GenericPoopComponent>().SetCurrentPoopScriptable(_currentPoop, _poopedBy); _currentPoop = null; _poopedBy = null; }
protected override void SetInitialValues() { _inputManager = GameObject.FindObjectOfType <InputManager>(); _playerStateManager = GameObject.FindObjectOfType <PlayerStateManager>(); _uiManager = GameObject.FindObjectOfType <UIManager>(); _animator = this.GetComponent <Animator>(); _currentInteractableState = EnumInteractableState.Nothing; _stomachComponent = this.GetComponent <StomachComponent>(); _animatorVariables = new InteractableAnimatorVariables(); }
private void OnApplyMetabolicMultiplier(EntityUid uid, StomachComponent component, ApplyMetabolicMultiplierEvent args) { if (args.Apply) { component.UpdateInterval *= args.Multiplier; return; } // This way we don't have to worry about it breaking if the stasis bed component is destroyed component.UpdateInterval /= args.Multiplier; // Reset the accumulator properly if (component.AccumulatedFrameTime >= component.UpdateInterval) { component.AccumulatedFrameTime = component.UpdateInterval; } }
public void TurnItIntoAPoop(PoopScriptable poopScriptable, StomachComponent poopedBy) { // => Player Structure _poopedBy = poopedBy; _animator.runtimeAnimatorController = poopScriptable.PoopAnimator; _isMainPlayer = false; _canMoveByClick = poopScriptable.CanMoveByClick; _canInteract = poopScriptable.CanInteract; _canPoop = poopScriptable.CanPoop; _spriteForActiveStatus = poopScriptable.SpriteForActiveStatus; // => Interact Component this._interactableComponent.TurnItIntoAPoop(poopScriptable); // => DamageTakerOptions _damageTakerComponent.TurnItIntoAPoop(poopScriptable); // => DamageDealerOptions _damageDealerComponent.TurnItIntoAPoop(poopScriptable); this.StartCoroutine(StartDeathCooldown(poopScriptable.DeathCooldown)); }
public void SetCurrentPoop(PoopScriptable currentPoop, StomachComponent poopedBy) { _currentPoop = currentPoop; _poopedBy = poopedBy; _animator.SetTrigger(_animatorVariables.StartPoop); }
private void LoadEntities() { throw new NotImplementedException(); int entitesCount = _savedComponents.Positions.Length; int?firstEntityIndex = null; _context.ReplacePlayerEntity(_savedComponents.PlayerEntityId); for (int i = 0; i < entitesCount; i++) { GameEntity entity = _context.CreateEntity(); if (!firstEntityIndex.HasValue) { firstEntityIndex = entity.creationIndex; } int currentEntityIndex = entity.creationIndex; int componentIndex = currentEntityIndex - firstEntityIndex.Value; IdComponent savedId = _savedComponents.Ids[componentIndex]; entity.ReplaceId(savedId.Id); bool[] componentPresence = _savedComponents.EntityToHasComponent[savedId.Id]; PositionComponent savedPosition = _savedComponents.Positions[componentIndex]; if (componentPresence[GameComponentsLookup.Position]) { entity.AddPosition(savedPosition.Position); entity.AddPositionAfterLastTurn(default(Position)); } VisionComponent savedVision = _savedComponents.Visions[componentIndex]; if (componentPresence[GameComponentsLookup.Vision]) { entity.AddVision(savedVision.VisionRange, savedVision.PerceptionRange, savedVision.EntitiesNoticed ?? new HashSet <Guid>()); } RecipeeComponent savedRecipee = _savedComponents.Recipees[componentIndex]; if (componentPresence[GameComponentsLookup.Recipee]) { entity.AddRecipee(savedRecipee.RecipeeName); } EnergyComponent savedEnergy = _savedComponents.Energies[componentIndex]; if (componentPresence[GameComponentsLookup.Energy]) { entity.AddEnergy(savedEnergy.EnergyGainPerSegment, savedEnergy.Energy); } IntegrityComponent savedIntegrity = _savedComponents.Integrities[componentIndex]; if (componentPresence[GameComponentsLookup.Integrity]) { entity.AddIntegrity(savedIntegrity.Integrity, savedIntegrity.MaxIntegrity); } SkillsComponent savedSkill = _savedComponents.Skills[componentIndex]; if (componentPresence[GameComponentsLookup.Skills]) { entity.AddSkills(savedSkill.Skills); } StomachComponent savedStomach = _savedComponents.Stomachs[componentIndex]; if (componentPresence[GameComponentsLookup.Stomach]) { entity.AddStomach(savedStomach.Satiation, savedStomach.MaxSatiation); } TeamComponent savedTeam = _savedComponents.Teams[componentIndex]; if (componentPresence[GameComponentsLookup.Team]) { entity.AddTeam(savedTeam.Team); } LooksComponent savedLooks = _savedComponents.Looks[componentIndex]; if (componentPresence[GameComponentsLookup.Looks]) { entity.AddLooks(savedLooks.BodySprite); } EdibleComponent savedEdible = _savedComponents.Edibles[componentIndex]; if (componentPresence[GameComponentsLookup.Edible]) { entity.AddEdible(savedEdible.Satiety); } if (componentPresence[GameComponentsLookup.BlockingPosition]) { entity.isBlockingPosition = true; } entity.isFinishedTurn = true; if (_context.playerEntity.Id == entity.id.Id) { entity.isPlayerControlled = true; } } }
public void SetCurrentPoopScriptable(PoopScriptable poop, StomachComponent poopedBy) { _currentPoop = poop; _poopedBy = poopedBy; }
private void OnComponentInit(EntityUid uid, StomachComponent component, ComponentInit args) { var solution = _solutionContainerSystem.EnsureSolution(uid, DefaultSolutionName); solution.MaxVolume = component.InitialMaxVolume; }