public void DropNewItem(Vector3 loc, Entity.EntityType type) { Item newItem = null; if (type == Entity.EntityType.Humanoid) { newItem = LootRandomizer.instance.DropLoot(aIL.averageILevel, 1); } else if (type == Entity.EntityType.Box) { newItem = LootRandomizer.instance.DropLoot(aIL.averageILevel, 2); } else if (type == Entity.EntityType.Chest) { newItem = LootRandomizer.instance.DropLoot(aIL.averageILevel, 3); } if (newItem == null) { return; } GameObject newObj = Database.hostInstance.allGameobjects[newItem.prefabIndex]; SaveItem(newItem, newObj.name, loc); }
public void PlayerBuyGood() { Transform row = EventSystem.current.currentSelectedGameObject.transform.parent.transform.parent; ResourceUtil.ResourceType type = rows[row]; Entity.EntityType agentType = ResourceUtil.GetResourceByType(type).ProducedBy; Guild guild = townController.town.Guilds[agentType]; float price = guild.Price; if (PlayerController.player.HasResource(type) == false) { PlayerController.player.AddResource(type); } if (PlayerController.player.ResourceInventory[type].Amount < PlayerController.player.ResourceInventory[type].Max) { guild.TransferResource(PlayerController.player, type, 1); PlayerController.player.TransferCurrency(guild, price); EventManager.TriggerEvent("UpdateCurrency"); } Debug.Log(EventSystem.current.currentSelectedGameObject.name); }
public void UseConfig(ChaserControllerConfig config) { if (config == null) { return; } ChaseDistance = config.chaseDistance; WanderSpeedMultiplier = config.wanderSpeedMultiplier; AggroRange = config.aggroRange; FramesSpentWandering = config.framesSpentWandering; FramesSpentStillAfterWander = config.framesSpentStillAfterWander; WanderingFramesVariance = config.wanderingFramesVariance; WanderingStartingCounter = config.startingCounter; if (config.targettingType == TargettingModule.Technique.ByEntityType) { Entity.EntityType t = config.targetEntityType; _targettingModule.CheckEntityCallback = (callingEntity, entityBeingChecked) => { if (entityBeingChecked.IsDead) { return(false); } if (!Behaviours.CheckIfEntityInSight(callingEntity, entityBeingChecked)) { return(false); } return(entityBeingChecked.Type == t); }; } }
/// <summary> /// Fire the weapon /// </summary> public void Fire(Entity.EntityType entityType) { if (nozzle != null) { BaseBullet obj = Instantiate(Details.BulletPrefab, nozzle.position, nozzle.rotation); obj.SetUp(Details.Damage, Details.BulletSpeed, entityType); } }
/// <summary> /// Set up the bullet object /// </summary> /// <param name="dmg"></param> /// <param name="type"></param> public void SetUp(float dmg, float speed, Entity.EntityType type) { Type = type; Damage = dmg; Speed = speed; Direction = transform.up; Position = transform.position; deathEffectListner = GetComponent <IDeathEffectListner>(); }
public GameObject GetEntity(EntityType type) { switch (type) { case EntityType.CREEPER: return(Creeper); case EntityType.COW: return(Cow); case EntityType.PIG: return(Pig); default: return(DefaultEntity); } }
// todo: use reflection to generate this as a dictionary dynamically at runtime public GameObject GetEntityPrefab(EntityType type) { switch (type) { case EntityType.Creeper: return(Creeper); case EntityType.Cow: return(Cow); case EntityType.Pig: return(Pig); case EntityType.Player: return(Player); default: return(DefaultEntity); } }