Here are the examples of the csharp api System.Collections.Generic.Dictionary.ContainsKey(UnitProfile) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
5 Examples
19
Source : CharacterPetManager.cs
with MIT License
from michaelday008
with MIT License
from michaelday008
public void AddTemporaryPet(UnitProfile unitProfile, UnitController unitController) {
if (unitController == null) {
return;
}
if (activeUnitProfiles.ContainsKey(unitProfile) == false) {
activeUnitProfiles.Add(unitProfile, unitController);
unitController.SetPetMode(baseCharacter, true);
unitController.OnUnitDestroy += HandleUnitDestroy;
}
}
19
Source : CharacterPetManager.cs
with MIT License
from michaelday008
with MIT License
from michaelday008
public void CapturePet(UnitProfile unitProfile, UnitController unitController) {
//Debug.Log(baseCharacter.gameObject.name + ".CharacterPetManager.CapturePet(" + (unitProfile == null ? "null" : unitProfile.DisplayName) + ", " + (unitController == null ? "null" : unitController.gameObject.name) + ")");
if (unitController == null) {
return;
}
// you can only have one of the same pet active at a time
if (activeUnitProfiles.ContainsKey(unitProfile) == false) {
activeUnitProfiles.Add(unitProfile, unitController);
unitController.SetPetMode(baseCharacter, true);
unitController.OnUnitDestroy += HandleUnitDestroy;
}
AddPet(unitProfile);
}
19
Source : CharacterPetManager.cs
with MIT License
from michaelday008
with MIT License
from michaelday008
public virtual void DespawnPet(UnitProfile unitProfile) {
//Debug.Log(baseCharacter.gameObject.name + ".CharacterPetManager.DeSpawnPet(" + unitProfile.DisplayName + ")");
if (activeUnitProfiles.ContainsKey(unitProfile)) {
if (activeUnitProfiles[unitProfile] != null) {
activeUnitProfiles[unitProfile].Despawn();
}
}
activeUnitProfiles.Remove(unitProfile);
}
19
Source : CharacterPetManager.cs
with MIT License
from michaelday008
with MIT License
from michaelday008
public virtual void HandleUnitDestroy(UnitProfile unitProfile) {
//Debug.Log(baseCharacter.gameObject.name + ".CharacterPetManager.HandleUnitDestroy(" + unitProfile.DisplayName + ")");
if (activeUnitProfiles.ContainsKey(unitProfile)) {
activeUnitProfiles[unitProfile].OnUnitDestroy -= HandleUnitDestroy;
activeUnitProfiles.Remove(unitProfile);
}
}
19
Source : CharacterPetManager.cs
with MIT License
from michaelday008
with MIT License
from michaelday008
public virtual void SpawnPet(UnitProfile unitProfile) {
//Debug.Log(baseCharacter.gameObject.name + ".CharacterPetManager.SpawnPet(" + unitProfile.DisplayName + ")");
if (activeUnitProfiles.ContainsKey(unitProfile)) {
// can't add the same dictionary key twice
return;
}
UnitController unitController = unitProfile.SpawnUnitPrefab(baseCharacter.UnitController.transform.parent, baseCharacter.UnitController.transform.position, baseCharacter.UnitController.transform.forward, UnitControllerMode.Pet);
if (unitController != null) {
unitController.SetPetMode(baseCharacter);
unitController.Init();
unitController.OnUnitDestroy += HandleUnitDestroy;
activeUnitProfiles.Add(unitProfile, unitController);
}
}