本文整理汇总了C#中Critter类的典型用法代码示例。如果您正苦于以下问题:C# Critter类的具体用法?C# Critter怎么用?C# Critter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Critter类属于命名空间,在下文中一共展示了Critter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Activate
public void Activate(Critter newCritter)
{
if(hex){
critter = newCritter;
UpdateInfo();
}
}
示例2: SetCritter
private void SetCritter()
{
if (!critter)
{
critter = FindObjectOfType<Player>().GetCritter();
}
}
示例3: PopulateTokenSpriteOptions
public static List<Sprite> PopulateTokenSpriteOptions(Critter.locomotionType[] locomotions)
{
List<Sprite> finalSpriteList = new List<Sprite>();
Sprite[] currentList;
string itemLocation = "";
foreach (Critter.locomotionType locoType in locomotions)
{
itemLocation = CheckTokenImageLocationString(locoType);
currentList = Resources.LoadAll<Sprite>(itemLocation);
currentList = pUnlocksControl.GenerateUnlockedSpriteList(currentList);
foreach (Sprite item in currentList)
{
if (!finalSpriteList.Contains(item))
{
finalSpriteList.Add(item);
}
}
}
finalSpriteList.TrimExcess();
return finalSpriteList;
}
示例4: Activate
public void Activate(Critter newCritter, Hex newHab)
{
critter = newCritter;
habitat = newHab;
warnControl = FindObjectOfType<WarningsController>();
}
示例5: Init
public static void Init(Critter ghost, bool firstTime)
{
if(firstTime)
{
// set max possible HP
ghost.Stat[Stats.MaxLife] = 9999;
ghost.Stat[Stats.CurrentHP] = 9999;
// and armor class
ghost.Stat[Stats.ArmorClass] = 90;
}
// syncronize ghost actual state with var value
if(ghost.Cond == Cond.Dead && GhostState == State.Alive )
{
ghost.ToLife();
}
else if(ghost.Cond != Cond.Dead && GhostState == State.Dead)
{
ghost.ToDead(Anim2.DeadBurnRun, null);
}
ghost.Attacked += _GhostAttacked;
ghost.Dead += _GhostDead;
ghost.Respawn += (self, e) => GhostState = State.Alive;
ghost.Stealing += _GhostStealing;
}
示例6: SetCritterTransformArray
public void SetCritterTransformArray(Critter sourceCritter) {
critter = sourceCritter;
critterDecorationsTest.critter = sourceCritter;
critterSegmentTransforms = new SegmentTransform[sourceCritter.critterSegmentList.Count]; // grab numSegments from Critter
for(int i = 0; i < sourceCritter.critterSegmentList.Count; i++) {
SegmentTransform segmentTransform;
segmentTransform.PX = sourceCritter.critterSegmentList[i].transform.position.x;
segmentTransform.PY = sourceCritter.critterSegmentList[i].transform.position.y;
segmentTransform.PZ = sourceCritter.critterSegmentList[i].transform.position.z;
segmentTransform.RX = sourceCritter.critterSegmentList[i].transform.rotation.x;
segmentTransform.RY = sourceCritter.critterSegmentList[i].transform.rotation.y;
segmentTransform.RZ = sourceCritter.critterSegmentList[i].transform.rotation.z;
segmentTransform.RW = sourceCritter.critterSegmentList[i].transform.rotation.w;
segmentTransform.SX = sourceCritter.critterSegmentList[i].transform.localScale.x / 2f;
segmentTransform.SY = sourceCritter.critterSegmentList[i].transform.localScale.y / 2f;
segmentTransform.SZ = sourceCritter.critterSegmentList[i].transform.localScale.z / 2f;
critterSegmentTransforms[i] = segmentTransform;
}
//Debug.Log("SetCritterTransformArray numSegments: " + critterSegmentTransforms.Length + ", BoundingBox: " + sourceCritter.BoundingBoxMinCorner.ToString() + " -> " + sourceCritter.BoundingBoxMaxCorner.ToString());
// Largest boundingBox dimension determines cellResolution?
GlobalBoundingBoxDimensions = (sourceCritter.BoundingBoxMaxCorner - sourceCritter.BoundingBoxMinCorner) * 1.15f; // buffer amount
GlobalBoundingBoxOffset = (sourceCritter.BoundingBoxMaxCorner + sourceCritter.BoundingBoxMinCorner) / 2f;
int approxChunksPerDimension = 5;
float avgRadius = (GlobalBoundingBoxDimensions.x + GlobalBoundingBoxDimensions.y + GlobalBoundingBoxDimensions.z) / 3f;
float chunkSize = avgRadius / (float)approxChunksPerDimension;
float cellSize = chunkSize / 8f;
cellResolution = cellSize;
}
示例7: Mutate
/// <summary>
/// Mutates a critter
/// </summary>
/// <param name="child">
/// The critter that is to be mutated.
/// </param>
/// <returns>
/// A mutated critter.
/// </returns>
public Critter Mutate(Critter child)
{
var rand = Random.GetInstance();
double u1 = rand.NextDouble(); // these are uniform(0,1) random doubles
double u2 = rand.NextDouble();
double randStdNormal = Math.Sqrt(-2.0 * Math.Log(u1)) * Math.Sin(2.0 * Math.PI * u2); // random no
int crossoverWeight = (int)Tools.Clamp(10 * randStdNormal, -30, 30);
child.DepartureTime = this.properties.DepartureTime.AddMinutes(crossoverWeight);
Assert.That(child.DepartureTime != default(DateTime));
var random = Random.GetInstance();
List<NodeWrapper<INetworkNode>> nodes = child.Route;
if (nodes.Count == 1)
{
return child;
}
int startIndex = random.Next(0, nodes.Count - 2);
int endIndex = random.Next(startIndex + 1, nodes.Count - 1);
NodeWrapper<INetworkNode> begin = nodes[startIndex];
NodeWrapper<INetworkNode> end = nodes[endIndex];
Route newSegment = this.properties.RouteGenerator.Generate(
begin.Node, end.Node);
var newRoute = new Route(Guid.NewGuid().GetHashCode());
newRoute.AddRange(nodes.GetRange(0, startIndex));
newRoute.AddRange(newSegment);
newRoute.AddRange(nodes.GetRange(endIndex + 1, nodes.Count - 1 - endIndex));
return new Critter((Route)newRoute.Clone(), new Fitness()) { DepartureTime = child.DepartureTime };
// return child;
}
示例8: Awake
void Awake ()
{
crit = GetComponent<Critter>();
if (sfx == null)
sfx = GameObject.Find("Audio/AudioSFX").GetComponent<AudioSource>();
}
示例9: Activate
public void Activate(Critter newCritter)
{
critter = newCritter;
slotIcons = GetComponentsInChildren<UISlot>();
InitializeSlots(critter, slotType);
}
示例10: Activate
public void Activate()
{
if (!playerCritter) { playerCritter = FindObjectOfType<Player>().GetCritter(); }
mainPanel.SetActive(true);
subPanel.Activate();
gameObject.SetActive(true);
}
示例11: Activate
public void Activate(Critter critter, Adaptation.BodySlot newType)
{
gameObject.SetActive(true);
InitializeSlots(critter, newType);
PopulatePanel();
}
示例12: Activate
public void Activate(Critter newCritter)
{
critter = newCritter;
if (critter) {
PopulateLocalCritterList();
}
}
示例13: GetTokenSpriteOptions
public static Sprite[] GetTokenSpriteOptions(Critter critter)
{
Critter.locomotionType[] locomotions = critter.GetLocomotion();
tokenSpriteOptions = PopulateTokenSpriteOptions(locomotions).ToArray();
return tokenSpriteOptions;
}
示例14: Activate
public void Activate(Critter newCritter, Hex newHab, WarningChecker.warningType newType, Sprite newSprite, Color32 color)
{
icon = GetComponentsInChildren<Image>()[1];
type = newType;
icon.sprite = newSprite;
icon.color = color;
}
示例15: Start
void Start()
{
critterGen = FindObjectOfType<CritterGenerator>();
myCritter = gameObject.GetComponent<Critter>();
cloneCritter = false;
splitTimer = timerResetVal;
currentTurn = TurnTimer.currentTurn;
}