本文整理汇总了C#中Individual.CheckPlayerState方法的典型用法代码示例。如果您正苦于以下问题:C# Individual.CheckPlayerState方法的具体用法?C# Individual.CheckPlayerState怎么用?C# Individual.CheckPlayerState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Individual
的用法示例。
在下文中一共展示了Individual.CheckPlayerState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PerformMyDecision
//this method signature means swap
public void PerformMyDecision (Mask myMaskToSwap, Individual swapW)
{
if (myMaskList.Count > 0 && swapW.myMaskList.Count > 0 && myMaskToSwap.MyOwner.Index != swapW.Index) {
//Debug.Log ("Performing a swap decision. " + Index);
int myRand = Random.Range (0, myMaskList.Count);
int theirRand = Random.Range (0, swapW.myMaskList.Count);
Individual orig_parent = myMaskToSwap.MyOwner;
if (swapW.Index == Index) {
//Debug.Log ("I'm swapping WITH MYSELF!!");
}
if (GameManager.instance.TurnPosition == 0) {
//Debug.Log ("Swap on turn position = " + GameManager.instance.TurnPosition);
//mySwapMask = myMaskToSwap;
myRand = myMaskList.IndexOf (myMaskToSwap);
}
//first store both the masks to be swapped in temp variables
Mask myPotentialMaskToSwap = myMaskList [myRand];
Mask theirPotentialMaskToSwap = swapW.myMaskList [theirRand];
myMaskList.Remove (myPotentialMaskToSwap);
swapW.myMaskList.Remove (theirPotentialMaskToSwap);
myMaskList.Insert (myRand, theirPotentialMaskToSwap);
swapW.myMaskList.Insert (theirRand, myPotentialMaskToSwap);
//tell me everything in my list
foreach(Mask msk in myMaskList){
//Debug.Log (" my Mask List after INSERT"+ msk.MyMaskType);
switch(msk.MyMaskType){
case MaskType.Attack:
msk.GetComponent<Image>().sprite = msk.myPossibleMaskImages[0];
break;
case MaskType.Defend:
msk.GetComponent<Image>().sprite = msk.myPossibleMaskImages[1];
break;
case MaskType.Switch:
msk.GetComponent<Image>().sprite = msk.myPossibleMaskImages[2];
break;
default:
break;
}
}
foreach(Mask msk in swapW.myMaskList){
//Debug.Log (" their mask list after INSERT " + msk.MyMaskType);
//tell me everything in their list
switch(msk.MyMaskType){
case MaskType.Attack:
msk.GetComponent<Image>().sprite = msk.myPossibleMaskImages[0];
break;
case MaskType.Defend:
msk.GetComponent<Image>().sprite = msk.myPossibleMaskImages[1];
break;
case MaskType.Switch:
msk.GetComponent<Image>().sprite = msk.myPossibleMaskImages[2];
break;
default:
break;
}
}
//Set the new parent
theirPotentialMaskToSwap.gameObject.transform.SetParent (orig_parent.transform, false);
theirPotentialMaskToSwap.gameObject.GetComponent<RectTransform>().localPosition = new Vector3(0,0,0);
theirPotentialMaskToSwap.MyOwner = orig_parent;
//Debug.Log ("*******Their mask to swap OWNER= "+theirPotentialMaskToSwap.MyOwner.Index );
myPotentialMaskToSwap.gameObject.transform.SetParent (swapW.transform, false);
myPotentialMaskToSwap.gameObject.GetComponent<RectTransform>().localPosition = new Vector3(0,0,0);
myPotentialMaskToSwap.MyOwner = swapW;
//Debug.Log ("********MY mask to swap OWNER= "+myPotentialMaskToSwap.MyOwner.Index );
if(myMaskList[myMaskList.Count-1] == null){
myMaskList.RemoveAt(myMaskList.Count-1);
}
if(swapW.myMaskList[swapW.myMaskList.Count-1] == null){
swapW.myMaskList.RemoveAt(swapW.myMaskList.Count-1);
}
foreach(Mask msk in myMaskList){
if(msk == null){
myMaskList.Remove(msk);
}
}
foreach(Mask msk in swapW.myMaskList){
if(msk == null){
swapW.myMaskList.Remove(msk);
}
}
CheckPlayerState ();
swapW.CheckPlayerState ();
DisplayOnlyTopMask ();
swapW.DisplayOnlyTopMask ();
//.........这里部分代码省略.........