private void BuildFESystem() { this.FEsystem = new StatSystem(); this.FEsystem.PointMergeTolerance = this.systemSettings.mergeTolerance_m; this.FEsystem.MergeNewNodes = true; sStatConverter conv = new sStatConverter(); foreach (IFrameSet bs in this.frameSets) { foreach (sFrame b in bs.frames) { StatCrossSection cs = conv.ToStatCrossSection(b, bs.AsMinuteDensity); StatNode n0 = this.FEsystem.AddNode(conv.ToCVector(b.node0)); StatNode n1 = this.FEsystem.AddNode(conv.ToCVector(b.node1)); C_vector uv = conv.ToCVector(b.upVector); StatBeam sb = this.FEsystem.AddBeam(n0, n1, cs, uv); b.extraData = sb; sb.ExtraData = b; } } foreach (sNode sn in this.nodes) { StatNode n = null; if (sn.boundaryCondition != null) { //n = this.FEsystem.AddNode(sn.location.X, sn.location.Y, sn.location.Z); n = FindStatNode(sn, this.systemSettings.mergeTolerance_m); if (sn.boundaryCondition.supportType == eSupportType.FIXED) { n.SupportType = BOUNDARYCONDITIONS.ALL; } else if (sn.boundaryCondition.supportType == eSupportType.PINNED) { n.SupportType = BOUNDARYCONDITIONS.TRANSLATIONS; } else if (sn.boundaryCondition.supportType == eSupportType.CUSTOM) { } } if (sn.pointLoads != null && sn.pointLoads.Count > 0) { n = FindStatNode(sn, this.systemSettings.mergeTolerance_m); } if (n != null) { sn.extraData = n; n.ExtraData = sn; } } }
void Awake() { gaStats = new GA_Stats(); timerStart = DateTime.Now; statSystem = gameObject.GetComponent <StatSystem>(); statSystem.SetCharacterType(0); GameAnalytics.Initialize(); GameAnalytics.NewProgressionEvent(GAProgressionStatus.Start, "Game start"); }
void Start() { player = GameObject.FindGameObjectWithTag("Player").transform; timeBetweenShots = startTimeBetweenShots; myRigidbody = GetComponent <Rigidbody2D>(); timeBetweenMoveCounter = timeBetweenMove; timeToMoveCounter = timeToMove; statSystem = GetComponent <StatSystem>(); statSystem.UpdateCharacterUI(); }
// Use this for initialization void Start() { stats = this.GetComponent <StatSystem>(); cc = this.GetComponent <CharacterController>(); stats.UpdateStats(); animator = GetComponentsInChildren <Animator>()[0]; if (animator.layerCount >= 2) { animator.SetLayerWeight(1, 1); } playerCamera = Camera.main; }
public void UpdateEquipment(EquipmentSystem equipment, StatSystem system) { var head = equipment.GetItem(EquipmentItem.EquipmentSlot.Head); var torso = equipment.GetItem(EquipmentItem.EquipmentSlot.Torso); var legs = equipment.GetItem(EquipmentItem.EquipmentSlot.Legs); var feet = equipment.GetItem(EquipmentItem.EquipmentSlot.Feet); var accessory = equipment.GetItem(EquipmentItem.EquipmentSlot.Accessory); var weapon = equipment.Weapon; HeadSlot.SetupEquipment(head); TorsoSlot.SetupEquipment(torso); LegsSlot.SetupEquipment(legs); FeetSlot.SetupEquipment(feet); AccessorySlot.SetupEquipment(accessory); WeaponSlot.SetupEquipment(weapon); }
void Start() { //Not the best way to get the player but it'll have to do for now player = GameObject.Find("Player"); sAggressive.setParent(this); sNeutral.setParent(this); sFriendly.setParent(this); stats = this.GetComponent <StatSystem>(); baseState.AddState("aggressive", sAggressive); baseState.AddState("neutral", sNeutral); baseState.AddState("friendly", sFriendly); baseState.ChangeState("neutral"); }
// Use this for initialization void Start() { if (isLocalPlayer) { statSystem = GetComponentInChildren <StatSystem>(); crewText = GameObject.FindGameObjectWithTag("CrewManagementUI").GetComponentInChildren <Text>(); cooldownImage = GameObject.FindGameObjectWithTag("CrewManagementUI").GetComponentInChildren <Image>(); cooldownImage.fillAmount = 0f; attackStage = CREW_MIN; defenseStage = CREW_MIN; speedStage = CREW_MIN; crewCount = startCrew; crewText.text = "Available Crew: " + crewCount; cooldownTimer = 0; } }
public override void Tick(StatSystem statSystem) { base.Tick(statSystem); _sinceLastDamage += Time.deltaTime; if (_sinceLastDamage > _damageSpeed) { _sinceLastDamage = 0; var data = new AttackData(_target); data.AddDamage(_damageType, _damage); statSystem.Damage(data); } //we do not parent as if the original object is destroy it would destroy the instance _fireInstance.Effect.transform.position = _target.transform.position + Vector3.up; }
void Start (){ //offset = new Vector3(0, 0f, 0f); myAudio = GetComponent<AudioSource>() as AudioSource; myParticleSystem = rootObject.GetComponentInChildren<ParticleSystem>() as ParticleSystem; myCamera = rootObject.GetComponentInChildren<MouseOrbit>() as MouseOrbit; myGunnerAim = rootObject.GetComponent<GunnerAim>() as GunnerAim; myStatSystem = rootObject.GetComponent<StatSystem>() as StatSystem; myCollider = rootObject.GetComponent<Collider>() as Collider; transform.parent = GameObject.Find("Floating Origin").transform; SceneState.OnStateChange += OnStateChange; CameraState.OnStateChange += OnStateChange; //myParticleSystem.emissionRate = 10; // foreach (Collider firstCollider in rootObject.GetComponentsInChildren<Collider>() as Collider[]) { // foreach (Collider secondCollider in rootObject.GetComponentsInChildren<Collider>() as Collider[]) { // if (firstCollider != secondCollider) { //// Physics.IgnoreCollision(firstCollider, secondCollider); //// Debug.Log (firstCollider.ToString() + " ignores collisions with " + secondCollider.ToString()); // } // } //} }
public Enemy(float maxhp, int ms, float defense, GameObject referenceObject) { enemyStats = new StatSystem(maxhp, ms, defense); this.referenceObject = referenceObject; o = new ObjectUpdate(); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { graphics.PreferredBackBufferWidth = Util.ScreenWidth; graphics.PreferredBackBufferHeight = Util.ScreenHeight; graphics.ApplyChanges(); Util.ContentPath = Content.RootDirectory; Log.Init(AppDomain.CurrentDomain.BaseDirectory); Log.Message("Seed: " + Seed); var gameData = GameData.Instance = new GameData(); var dataPath = Util.ContentPath + "/GameData/"; gameData.LoadEntities(EntityType.Terrain, dataPath + "Entities/Terrains"); gameData.LoadEntities(EntityType.Structure, dataPath + "Entities/Structures"); gameData.LoadEntities(EntityType.Character, dataPath + "Entities/Characters"); gameData.LoadEntities(EntityType.Item, dataPath + "Entities/Items"); var herb = gameData.CreateItem("randomHerb"); var herbSubstance = EntityManager.GetComponent <SubstanceComponent>(herb); gameData.LoadTilesets(dataPath + "tilesets.json"); gameData.LoadRoomTemplates(dataPath); //Floor test = new Floor(Content.RootDirectory + "/map.txt"); Floor testFloor = new Floor(500, 500); //testFloor.GenerateSimple(); testFloor.GenerateGraphBased(); //EntityManager.Dump(); Util.CurrentFloor = testFloor; Util.CurrentFloor.CalculateTileVisibility(); // Delete entities that were removed during generation EntityManager.CleanUpEntities(); //Log.Data(DescriptionSystem.GetDebugInfoEntity(Util.PlayerID)); InputManager input = InputManager.Instance; // instantiate all the systems Log.Message("Loading Systems..."); inputSystem = new InputSystem(); movementSystem = new MovementSystem(); renderSystem = new RenderSystem(GraphicsDevice); collisionSystem = new CollisionSystem(); healthSystem = new HealthSystem(); combatSystem = new CombatSystem(); npcBehaviourSystem = new NPCBehaviourSystem(); interactionSystem = new InteractionSystem(); itemSystem = new ItemSystem(); uiSystem = new UISystem(); statSystem = new StatSystem(); craftingSystem = new CraftingSystem(); // toggle FOW renderSystem.FogOfWarEnabled = true; // hook up all events with their handlers Log.Message("Registering Event Handlers..."); input.MovementEvent += movementSystem.HandleMovementEvent; input.InventoryToggledEvent += uiSystem.HandleInventoryToggled; input.InventoryCursorMovedEvent += uiSystem.HandleInventoryCursorMoved; input.PickupItemEvent += itemSystem.PickUpItem; input.InteractionEvent += interactionSystem.HandleInteraction; input.ItemUsedEvent += itemSystem.UseItem; input.ItemConsumedEvent += itemSystem.ConsumeItem; // crafting input.AddItemAsIngredientEvent += craftingSystem.AddIngredient; input.CraftItemEvent += craftingSystem.CraftItem; input.ResetCraftingEvent += craftingSystem.ResetCrafting; interactionSystem.ItemAddedEvent += itemSystem.AddItem; itemSystem.HealthGainedEvent += healthSystem.HandleGainedHealth; itemSystem.HealthLostEvent += healthSystem.HandleLostHealth; itemSystem.StatChangedEvent += statSystem.ChangeStat; npcBehaviourSystem.EnemyMovedEvent += movementSystem.HandleMovementEvent; movementSystem.CollisionEvent += collisionSystem.HandleCollision; movementSystem.BasicAttackEvent += combatSystem.HandleBasicAttack; movementSystem.InteractionEvent += interactionSystem.HandleInteraction; craftingSystem.ItemAddedEvent += itemSystem.AddItem; Util.TurnOverEvent += healthSystem.RegenerateEntity; Util.TurnOverEvent += statSystem.TurnOver; combatSystem.HealthLostEvent += healthSystem.HandleLostHealth; Log.Message("Loading Keybindings..."); string keybindings = File.ReadAllText(Util.ContentPath + "/GameData/keybindings.json"); input.LoadKeyBindings(keybindings); input.EnterDomain(InputManager.CommandDomain.Exploring); // start out with exploring as bottom level command domain input.ControlledEntity = Util.PlayerID; base.Initialize(); Log.Message("Initialization completed!"); //CraftableComponent.foo(); int testRock = EntityManager.CreateEntity(new List <IComponent>() { new DescriptionComponent() { Name = "Rock", Description = "You can't stop the rock!" }, new ItemComponent() { MaxCount = 5, Count = 3, Value = 1, Weight = 10 } }, EntityType.Item); // fill inventory with test items itemSystem.AddItems(Util.PlayerID, new int[] { //testRock, GameData.Instance.CreateItem("healthPotion"), GameData.Instance.CreateItem("healthPotion"), GameData.Instance.CreateItem("healthPotion"), GameData.Instance.CreateItem("poisonPotion"), GameData.Instance.CreateItem("poisonPotion"), GameData.Instance.CreateItem("elementalPotion") }); //EntityManager.Dump(); //EntityManager.RemoveEntity(testBush); //EntityManager.CleanUpEntities(); //EntityManager.Dump(); //Log.Data(DescriptionSystem.GetDebugInfoEntity(Util.GetPlayerInventory().Items[0])); LocationSystem.UpdateDistanceMap(Util.PlayerID); }
/// <summary>To be implemented to make the stat system modify itself using this method</summary> public abstract void Modify(StatSystem system);
public void CreateSystems(string rngSeed) { ScriptExecutor = new ScriptExecutor(this); EventSystem = new EventSystem.EventSystem(); MessageSystem = new MessageSystem(); ActivitySystem = new ActivitySystem(); PlayerSystem = new PlayerSystem(ActivitySystem); MapSystem = new MapSystem(); RendererSystem = new RendererSystem(PlayerSystem, ActivitySystem, _renderer); EntityEngine = new EntityEngine(_prototypeEntityDataProvider, _additionalComponentTypes); StatSystem = new StatSystem(EntityEngine); PositionSystem = new PositionSystem(MapSystem, EntityEngine, new AStarPathfindingAlgorithm()); EntityEngine.Register(PositionSystem); Random = new RNG(rngSeed); AnimationRandom = new RNG(rngSeed); TimeSystem = new TimeSystem(this); EntityEngine.Register(TimeSystem); FighterSystem = new FighterSystem(EntityEngine, MessageSystem, EventSystem, TimeSystem, StatSystem); EntityEngine.Register(FighterSystem); PrototypeSystem = new PrototypeSystem(EntityEngine, PositionSystem, this); EntityEngine.Register(PrototypeSystem); ItemSystem = new ItemSystem(EntityEngine, PrototypeSystem, ScriptExecutor, MessageSystem, EventSystem); EntityEngine.Register(ItemSystem); SkillSystem = new SkillSystem(this); EntityEngine.Register(SkillSystem); AnimationSystem = new AnimationSystem(new EncapsulatedStopwatch(), AnimationRandom); EntityEngine.Register(AnimationSystem); AnimatedMovementSystem = new AnimatedMovementSystem(EntityEngine, new EncapsulatedStopwatch()); EntityEngine.Register(AnimatedMovementSystem); ParticleSystem = new ParticleSystem(AnimationSystem, EntityEngine); EntityEngine.Register(ParticleSystem); SoundSystem = new SoundSystem(); EntityEngine.Register(SoundSystem); InteractableSystem = new InteractionSystem(PositionSystem); EntityEngine.Register(InteractableSystem); Seed = rngSeed; EquipmentSystem = new EquipmentSystem(this); TargetingSystem = new TargetingSystem(this); FactionSystem = new FactionSystem(); ControlSystem = new ControlSystem(this, _keyBindingsDataProvider); SaveSystem = new SaveSystem(this, new WorldGenerator(_worldEntityDataProvider, _playerEntityDataProvider, _vaultDataProvider)); EntityEngine.Initialise(this); ControlSystem.Initialise(); Verify(); }
public virtual void Tick(StatSystem statSystem) { _timer -= Time.deltaTime; }
// Start is called before the first frame update void Start() { statSystem = GetComponent <StatSystem>(); statSystem.UpdateCharacterUI(); }
void Start() { statSystem = FindObjectOfType <StatSystem>(); }
void OnNetworkStateChange() { player = NetworkManager.player.transform; statSystem = player.GetComponent<StatSystem>(); }
void Awake() { statSystem = gameObject.GetComponent <StatSystem>(); statSystem.SetCharacterType(1); }
private void Awake() { stats = Object.Instantiate(statAsset); }
public void Dispose() { this.FEsystem = null; }