public override void Execute() { SkillsManager.Initialize(); List <ControllableUnit> teamAUnits = BattleComposition.Instance.GetAllTeamAUnits(); List <ControllableUnit> teamBUnits = BattleComposition.Instance.GetAllTeamBUnits(); //all units get NORMAL skill foreach (ControllableUnit unit in teamAUnits) { UnitIdentity unitID = unit.GetUnitIdentity(); NormalAttackSkill normalAttack = new NormalAttackSkill(); SkillsManager.Instance.AddSkill(unitID, normalAttack.GetSkillName(), normalAttack); Debug.Log("Skill added to " + unitID.GetUnitName() + " Skill Name: " + normalAttack.GetSkillName()); } //all units get NORMAL skill foreach (ControllableUnit unit in teamBUnits) { UnitIdentity unitID = unit.GetUnitIdentity(); NormalAttackSkill normalAttack = new NormalAttackSkill(); SkillsManager.Instance.AddSkill(unitID, normalAttack.GetSkillName(), normalAttack); Debug.Log("Skill added to " + unitID.GetUnitName() + " Skill Name: " + normalAttack.GetSkillName()); } this.ReportFinished(); }
// Use this for initialization void Start() { if (identity == null) { identity = GetComponent <UnitIdentity>(); } if (engine == null) { engine = GetComponent <ShipEngine>(); } if (weaponHolder == null) { weaponHolder = GetComponent <ShipboardWeaponHolder>(); } if (health == null) { health = GetComponent <Health>(); } if (sheild == null) { sheild = GetComponent <Sheild>(); } if (master != null) { master.Register(this); } }
void Start() { this.characterData = new CharacterData(new AttackAttribute(this.attackDefaultValue.value, this.attackDefaultValue.multiplier), new DefenseAttribute(this.defenseDefaultValue.value, this.defenseDefaultValue.multiplier), new SpeedAttribute(this.speedDefaultValue.value, this.speedDefaultValue.multiplier), new HealthAttribute(this.healthDefaultValue.value, this.healthDefaultValue.multiplier)); this.unitID = new UnitIdentity(this.unitName); this.PrintCharacterStats(); EventBroadcaster.Instance.PostEvent(EventNames.ON_UNIT_INITIALIZE_SUCCESS); }
public void AddSkill(UnitIdentity owner, string skillUniqueName, ISkill skill) { if(this.skillSetTable.ContainsKey(owner)) { this.skillSetTable[owner].Add(skillUniqueName, skill); } else { Dictionary<string, ISkill> unitSkillTable = new Dictionary<string, ISkill>(); unitSkillTable.Add(skillUniqueName, skill); this.skillSetTable.Add(owner, unitSkillTable); } }
public void AddSkill(UnitIdentity owner, string skillUniqueName, ISkill skill) { if (this.skillSetTable.ContainsKey(owner)) { this.skillSetTable[owner].Add(skillUniqueName, skill); } else { Dictionary <string, ISkill> unitSkillTable = new Dictionary <string, ISkill>(); unitSkillTable.Add(skillUniqueName, skill); this.skillSetTable.Add(owner, unitSkillTable); } }
public void Rpc_dealDamage(GameObject attackingUnit, GameObject enemy) { Debug.Log(enemy.name); if (enemy.GetComponent <BasicAnt> () && attackingUnit.GetComponent <BasicAnt> ()) { BasicAnt enemyAnt = enemy.GetComponent <BasicAnt> (); UnitIdentity enemyAntIdentity = enemy.GetComponent <UnitIdentity> (); BasicAnt myAnt = attackingUnit.GetComponent <BasicAnt> (); UnitIdentity myAntIdentity = attackingUnit.GetComponent <UnitIdentity> (); if (myAntIdentity.id == enemyAntIdentity.id) { return; } enemyAnt.health -= Random.Range(0, myAnt.damage); myAnt.health -= Random.Range(0, enemyAnt.damage); } if (enemy.GetComponent <Anthill> () && attackingUnit.GetComponent <BasicAnt> ()) { Anthill enemyAntHill = enemy.GetComponent <Anthill> (); BasicAnt myAnt = attackingUnit.GetComponent <BasicAnt> (); UnitIdentity antHillIdentity = enemy.GetComponent <UnitIdentity> (); UnitIdentity myAntIdentity = attackingUnit.GetComponent <UnitIdentity> (); Debug.Log("shit works up to here1"); if (myAntIdentity.id == antHillIdentity.id) { return; } Debug.Log("shit works up to here2"); enemyAntHill.health -= Random.Range(0, myAnt.damage); Debug.Log("shit works up to here3"); } else { Debug.Log(enemy.name); Debug.Log(attackingUnit.name); } }
public ISkill GetSkill(UnitIdentity owner, string skillUniqueName) { if(this.skillSetTable.ContainsKey(owner)) { Dictionary<string, ISkill> unitSkillSet = this.skillSetTable[owner]; if(unitSkillSet.ContainsKey(skillUniqueName)) { return unitSkillSet[skillUniqueName]; } else { Debug.LogError(skillUniqueName + " was not found."); return null; } } else { Debug.LogError(owner + " was not found in the skills manager. Do they exist?"); return null; } }
public void Initialize(UnitIdentity target) { if (target == null) { hidden = true; return; } else { this.target = target; masterName.text = target.master.playerName; unitName.text = target.unitName; makerName.text = target.makerName; modelName.text = target.modelName; masterImage.color = target.master.primaryColor; targetUnit = target.GetComponent <Unit>(); hidden = false; } }
private FindReachable( IMetadataHost host, MetadataTraverser myTraverser, ISlice <MethodReferenceAdaptor, FieldReferenceAdaptor, TypeReferenceAdaptor, IAssemblyReference> slice, HashSet <object> thingsToKeep, HashSet <uint> methodsWhoseBodiesShouldBeKept ) { Contract.Requires(host != null); Contract.Requires(myTraverser != null); Contract.Requires(slice != null); Contract.Requires(thingsToKeep != null); Contract.Requires(methodsWhoseBodiesShouldBeKept != null); this.host = host; this.traverser = myTraverser; this.unitIdentity = slice.ContainingAssembly.UnitIdentity; this.slice = slice; this.thingsToKeep = thingsToKeep; this.methodsWhoseBodiesShouldBeKept = methodsWhoseBodiesShouldBeKept; this.contractOffsets = new Dictionary <IMethodDefinition, uint>(); }
public ISkill GetSkill(UnitIdentity owner, string skillUniqueName) { if (this.skillSetTable.ContainsKey(owner)) { Dictionary <string, ISkill> unitSkillSet = this.skillSetTable[owner]; if (unitSkillSet.ContainsKey(skillUniqueName)) { return(unitSkillSet[skillUniqueName]); } else { Debug.LogError(skillUniqueName + " was not found."); return(null); } } else { Debug.LogError(owner + " was not found in the skills manager. Do they exist?"); return(null); } }
void Start() { //healthBar = transform.FindChild ("Canvas").FindChild ("HealthBar").gameObject; unitIdentity = GetComponent <UnitIdentity> (); cameraAntHillPos = new Vector3(transform.position.x, 43.2f, transform.position.z); spawnAttackAnt = GameObject.Find("Canvas").transform.FindChild("SpawnAttackAnt").gameObject; spawnBeatleUnit = GameObject.Find("Canvas").transform.FindChild("SpawnBeatleUnit").gameObject; unitInfo = GameObject.Find("Canvas").transform.FindChild("UnitInfo").gameObject; spawnAttackAnt.GetComponent <Button>().onClick.AddListener(() => spawnBasicAntUnit()); spawnBeatleUnit.GetComponent <Button> ().onClick.AddListener(() => spawnBeatle()); maxHealth = 200; health = 200; damage = 0; if (gameObject.name.Contains("anthill")) { gameObject.name = "Ant Hill"; } }
public IContractExtractor GetContractExtractor(UnitIdentity unitIdentity) { throw new NotImplementedException(); }
public RewriteUnitReferences(IMetadataHost host, Module sourceUnit) : base(host) { this.sourceUnitIdentity = sourceUnit.UnitIdentity; }
/// <summary> /// A mutator that, when it visits anything, converts any references defined in the <paramref name="sourceUnitIdentity"/> /// into references defined in the <paramref name="targetUnit"/> /// </summary> /// <param name="host"> /// The host that loaded the <paramref name="targetUnit"/> /// </param> /// <param name="targetUnit"> /// The unit to which all references in the <paramref name="sourceUnitIdentity"/> /// will mapped. /// </param> /// <param name="sourceUnitIdentity"> /// The unit from which references will be mapped into references from the <paramref name="targetUnit"/> /// </param> internal ActualMutator(IMetadataHost host, IUnit targetUnit, UnitIdentity sourceUnitIdentity) : base(host) { this.sourceUnitIdentity = sourceUnitIdentity; this.targetUnit = targetUnit; }
internal MappingMutator(IMetadataHost host, IUnit targetUnit, IUnit sourceUnit) { this.host = host; this.sourceUnitIdentity = sourceUnit.UnitIdentity; this.targetUnit = targetUnit; }
private FindReachable( IMetadataHost host, MetadataTraverser myTraverser, ISlice<MethodReferenceAdaptor, FieldReferenceAdaptor, TypeReferenceAdaptor, IAssemblyReference> slice, HashSet<object> thingsToKeep, HashSet<uint> methodsWhoseBodiesShouldBeKept ) { Contract.Requires(host != null); Contract.Requires(myTraverser != null); Contract.Requires(slice != null); Contract.Requires(thingsToKeep != null); Contract.Requires(methodsWhoseBodiesShouldBeKept != null); this.host = host; this.traverser = myTraverser; this.unitIdentity = slice.ContainingAssembly.UnitIdentity; this.slice = slice; this.thingsToKeep = thingsToKeep; this.methodsWhoseBodiesShouldBeKept = methodsWhoseBodiesShouldBeKept; this.contractOffsets = new Dictionary<IMethodDefinition, uint>(); }
public MappingMutator(IMetadataHost host, IUnit targetUnit, IUnit sourceUnit) { this.host = host; this.sourceUnitIdentity = sourceUnit.UnitIdentity; this.targetUnit = targetUnit; }
/// <summary> /// A mutator that, when it visits anything, converts any references defined in the <paramref name="sourceUnit"/> /// into references defined in the <paramref name="targetUnit"/> /// </summary> /// <param name="host"> /// The host that loaded the <paramref name="targetUnit"/> /// </param> /// <param name="targetUnit"> /// The unit to which all references in the <paramref name="sourceUnit"/> /// will mapped. /// </param> /// <param name="sourceUnit"> /// The unit from which references will be mapped into references from the <paramref name="targetUnit"/> /// </param> public ActualMutator(IMetadataHost host, IUnit targetUnit, UnitIdentity sourceUnitIdentity) : base(host) { this.sourceUnitIdentity = sourceUnitIdentity; this.targetUnit = targetUnit; }
/// <summary> /// If a unit has been loaded with this host, then it will have attached a (lazy) contract provider to that unit. /// This method returns that contract provider. If the unit has not been loaded by this host, then null is returned. /// </summary> public IContractExtractor/*?*/ GetContractExtractor(UnitIdentity unitIdentity) { IContractExtractor cp; if (!this.unit2ContractExtractor.TryGetValue(unitIdentity, out cp)) return null; if (cp == null) { foreach (var u in this.LoadedUnits) { if (u.UnitIdentity.Equals(unitIdentity)) { this.AttachContractExtractorAndLoadReferenceAssembliesFor(u); cp = this.unit2ContractExtractor[unitIdentity]; break; } } } return cp; }