Exemplo n.º 1
0
        //Untested
        public bool Switch(Beast beastOut, Beast beastIn)
        {
            //UnityEngine.Debug.LogFormat("Switching out {0} for {1}", beastOut.data.dataName, beastIn.data.dataName);
            if (!beastIn.Equals(beastOut) && Contains(beastOut) && Contains(beastIn))
            {
                int moveTo   = Members.IndexOf(beastOut);
                int moveFrom = Members.IndexOf(beastIn);

                Members.Remove(beastOut);
                Members.Remove(beastIn);
                Members.Insert(moveTo, beastIn);
                Members.Insert(moveFrom, beastOut);
                return(true);
            }
            else
            {
                UnityEngine.Debug.LogFormat("Failed to switch {0} with {1}", beastOut, beastIn);
                return(false);
            }
        }