public void Init (PlType type) 
	{
		this.type = type;

		transform.position = Camera.main.transform.position;
		transform.rotation = Camera.main.transform.rotation;
		transform.parent = Camera.main.transform.parent;

		if(type == PlType.Fugitive)
		{
			dest_POV = POVManager_ANMP.Instance.GetStartPOV();
			Cardboard.SDK.transform.position = dest_POV.position;		
		}
	}
Example #2
0
    public void RemoveBot(PlType type, Team team)
    {
        var bot = PlayerViews.FirstOrDefault(a => a.team == team && a.plType == type);

        shareds[bot.id].CallRPC(shareds[bot.id].Die, PhotonTargets.All);
        RemovePlayerView(bot.id);
    }
Example #3
0
 private void DrawBotMenu(Team team, PlType pltype)
 {
     gui.BeginHorizontal();
     gui.Label(pltype + "");
     if (gui.Button("<", gui.ExpandWidth(false)))
     {
         _Game.RemoveBot(pltype, team);
     }
     gui.Label("" + _Game.PlayerViews.Count(a => a.team == team && a.plType == pltype), gui.ExpandWidth(false));
     if (gui.Button(">", gui.ExpandWidth(false)))
     {
         _Game.CreateBot(pltype, team);
     }
     gui.EndHorizontal();
 }
Example #4
0
 public GameObject GetPrefab(PlType type)
 {
     if (type == PlType.Player || type == PlType.Bot)
     {
         return(PlayerPrefab);
     }
     if (type == PlType.Monster)
     {
         return(MonsterPrefab);
     }
     if (type == PlType.Fatty)
     {
         return(FattyPrefab);
     }
     return(PlayerPrefab);
 }
Example #5
0
    public void CreateBot(PlType type, Team team)
    {
        var id = _Game.GetNextFreeSlot();

        if (id > 50)
        {
            Debug.LogWarning("Max Bot Limit");
        }
        else
        {
            Debug.Log("Create " + type + id);
            CallRPC(AddPlayerView, PhotonTargets.AllBuffered, id, type + "" + id);
            playerViews[id].plType = type;
            playerViews[id].team   = team;
            playerViews[id].skin   = Random.Range(0, 3);
            InstanciateShared(id, GetPrefab(type));
        }
    }
Example #6
0
 internal static int PL_unify_wchars(uintptr_t t1, PlType type, int len, string wchars)
 {
     Check.Require(type == PlType.PlAtom || type == PlType.PlString || type == PlType.PlCharList || type == PlType.PlCodeList);
     return(SafeNativeMethods.PL_unify_wchars(t1, (int)type, len, wchars));
 }
Example #7
0
 /// <summary>
 /// Unify t with a textual representation of the C wide-character array s.
 /// The type argument defines the Prolog representation and is one of PL_ATOM, PL_STRING, PL_CODE_LIST or PL_CHAR_LIST.
 /// </summary>
 /// <param name="t1"></param>
 /// <param name="type"></param>
 /// <param name="wchars"></param>
 /// <returns></returns>
 internal static int PL_unify_wchars(uintptr_t t1, PlType type, string wchars)
 {
     return(PL_unify_wchars(t1, type, wchars.Length, wchars));
 }
Example #8
0
        public static Object CastTerm0(PlTerm o, Type pt)
        {
            if (pt == typeof(PlTerm))
            {
                return(o);
            }
            if (pt == typeof(string))
            {
                if (IsTaggedObject(o))
                {
                    return("" + GetInstance(o));
                }
                return((string)o);
            }
            if (pt != null && pt.IsSubclassOf(typeof(Delegate)))
            {
                return(cliNewDelegateTerm(pt, o, false));
            }
            if (pt == typeof(Type))
            {
                return(GetType(o));
            }
            PlType plType = o.PlType;

            switch (plType)
            {
            case PlType.PlUnknown:
            {
                return((string)o);
            }
            break;

            case PlType.PlVariable:
            {
                return(o);
            }
            break;

            case PlType.PlInteger:
            {
                int i = 0;
                if (0 != libpl.PL_get_integer(o.TermRef, ref i))
                {
                    return(i);
                }
                try
                {
                    return((long)o);
                }
                catch (Exception)
                {
                }
                try
                {
                    return((ulong)o);
                }
                catch (Exception)
                {
                    return(ToBigInteger((string)o));
                }
            }
            break;

            case PlType.PlFloat:
            {
                try
                {
                    return((double)o);
                }
                catch (Exception)
                {
                    return(ToBigDecimal((string)o));
                }
            }
            break;

            case PlType.PlAtom:
            case PlType.PlString:
            {
                if (plType == PlType.PlAtom && o.Name == "[]")
                {
                    return(CastCompoundTerm(o.Name, o.Arity, o, o, pt));
                }
                string s = (string)o;
                if (pt == null)
                {
                    return(s);
                }
                var constructor = pt.GetConstructor(ONE_STRING);
                if (constructor != null)
                {
                    return(constructor.Invoke(new object[] { s }));
                }
                foreach (var m in pt.GetMethods(BindingFlagsJustStatic))
                {
                    ParameterInfo[] mGetParameters = m.GetParameters();
                    if (pt.IsAssignableFrom(m.ReturnType) && mGetParameters.Length == 1 &&
                        mGetParameters[0].ParameterType.IsAssignableFrom(typeof(string)))
                    {
                        WarnMissing("using " + m);
                        try
                        {
                            return(m.Invoke(null, new object[] { s }));
                        }
                        catch (Exception)
                        {
                            continue;
                        }
                    }
                }
                return(s);
            }
            break;

            case PlType.PlTerm:
            {
                lock (ToFromConvertLock)
                {
                    return(CastCompoundTerm(o.Name, o.Arity, o[1], o, pt));
                }
            }
            break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
 private void DrawBotMenu(Team team, PlType pltype)
 {
     gui.BeginHorizontal();
     gui.Label(pltype + "");
     if (gui.Button("<", gui.ExpandWidth(false)))
         _Game.RemoveBot(pltype, team);
     gui.Label("" + _Game.PlayerViews.Count(a => a.team == team && a.plType == pltype), gui.ExpandWidth(false));
     if (gui.Button(">", gui.ExpandWidth(false)))
         _Game.CreateBot(pltype, team);
     gui.EndHorizontal();
 }
Example #10
0
 public GameObject GetPrefab(PlType type)
 {
     if (type == PlType.Player || type == PlType.Bot)
         return PlayerPrefab;
     if (type == PlType.Monster)
         return MonsterPrefab;
     if (type == PlType.Fatty)
         return FattyPrefab;
     return PlayerPrefab;
 }
Example #11
0
 public void CreateBot(PlType type, Team team)
 {
     var id = _Game.GetNextFreeSlot();
     if (id > 50) Debug.LogWarning("Max Bot Limit");
     else
     {
         Debug.Log("Create " + type + id);
         CallRPC(AddPlayerView, PhotonTargets.AllBuffered, id, type + "" + id);
         playerViews[id].plType = type;
         playerViews[id].team = team;
         playerViews[id].skin = Random.Range(0, 3);
         InstanciateShared(id, GetPrefab(type));
     }
 }
Example #12
0
 public void RemoveBot(PlType type, Team team)
 {
     var bot = PlayerViews.FirstOrDefault(a => a.team == team && a.plType == type);
     shareds[bot.id].CallRPC(shareds[bot.id].Die, PhotonTargets.All);
     RemovePlayerView(bot.id);
 }