Esempio n. 1
0
 public void PlaceDownGuardedTile(Bolt.PrefabId EntityToSpawn)
 {
     if (AreaEntity == null && !CheckForPlacements()) // if there is nothing currently occupying this area, place down trap.
     {
         ToggleAreaEntity(false);                     // successfully placed down trap;
         Debug.LogWarning(transform.parent.name);
         AreaEntity = BoltNetwork.Instantiate(EntityToSpawn, GuardedHologram.transform.position, new Quaternion(0, 0, 0, 0)).gameObject;
     }
 }
Esempio n. 2
0
 public bool PlaceDownTrap(Bolt.PrefabId EntityToSpawn)
 {
     if (AreaEntity == null && !CheckForPlacements()) // if there is nothing currently occupying this area, place down trap.
     {
         ToggleAreaEntity(false);                     // successfully placed down trap;
         AreaEntity = BoltNetwork.Instantiate(EntityToSpawn, TrapHollogram.transform.position, Quaternion.identity).gameObject;
         return(true);
     }
     return(false);
 }
Esempio n. 3
0
 public void SelectCar(string caryboi)
 {
     if (caryboi == "Lamborghini")
     {
         car = BoltPrefabs.Lame_bo_gi_9;
     }
     else
     {
         car = BoltPrefabs.CityGoUI;
     }
 }
 public Quaternion GetitemRotation(Bolt.PrefabId item)
 {
     if (item == BoltPrefabs.Hammer_ItemBlock_Final)
     {
         return(Quaternion.Euler(22.383f, 0, 0));
     }
     if (item == BoltPrefabs.Shield_ItemBlock)
     {
         return(Quaternion.Euler(-90, 0, 0));
     }
     else
     {
         return(Quaternion.Euler(0, 0, 0));
     }
 }
Esempio n. 5
0
    /// <summary>
    /// Spawns a player prefab with the given actor token.
    /// </summary>
    /// <param name="prefab"></param>
    /// <param name="token"></param>
    public void Spawn(Bolt.PrefabId prefab, ActorSpawnToken token)
    {
        if (!actor)
        {
            //actor = BoltNetwork.Instantiate(BoltPrefabs.Player, token);
            //actor = BoltNetwork.Instantiate(token.actorPrefab, token, token.actorPos, Quaternion.identity);
            actor = BoltNetwork.Instantiate(prefab, token, token.actorPos, Quaternion.identity);
        }

        // Server takes control of the char it spawns;
        // client is GIVEN control of the char it spawns.
        if (isServer)
        {
            Debug.Log("Server taking control of " + actor.prefabId);
            actor.TakeControl();
        }
        else
        {
            BoltConsole.Write("Server has NOT taken control of the actor.");
        }
    }
Esempio n. 6
0
    public void InitializeItem(string ItemID)                       // initialize only weapons and traps
    {
        if (entity.IsOwner)
        {
            if (PlayerInventory == null)
            {
                PlayerInventory = FindObjectOfType <Inventory>();
            }
            PlayerInventory.InitializeInventory(ItemID);
            Bolt.PrefabId ItemPrefab = c_Item_Types.GetItem(ItemID);
            var           Entity     = BoltNetwork.Instantiate(ItemPrefab, Hammer.position, Hammer.rotation);
            state.Weapon      = Entity;                    // reference for the weapon.
            state.WeaponIndex = ItemID;
            Entity.transform.SetParent(SetWeaponParent()); // spawn under the hammer to copy its animation.
            Entity.transform.localPosition = Vector3.zero; // varies from item to item.
            Entity.transform.localRotation = new Quaternion(0, 0, 0, 0);

            if (ItemID == "2.1")
            {
                var trap = Entity.GetComponent <TrapAttack>();
                trap.InitializeTrapSystem(GetComponentInParent <Bolt_PlayerController>().GetGroundCheckTransform(), this);
                trap.InitializeUI(this);
            }
            else if (ItemID == "1.1" | ItemID == "1.3")
            {
                var wep = Entity.GetComponent <WeaponAttack>();
                wep.InitializeUI(this);
            }

            /*
             * var evnt = GetWeaponEvent.Create();
             * evnt.Weapon = Entity;
             * evnt.PlayerEntity = GetComponentInParent<BoltEntity>();
             * evnt.Send();
             */
        }
    }
Esempio n. 7
0
    void SendBulletFiredEvent(BoltEntity a_playerFiringEntity, Vector3 a_startPos, Vector3 a_endPos, Bolt.PrefabId a_bulletTrailPrefabId)
    {
        var myEvent = PlayerHitscanFiredEvent.Create(a_playerFiringEntity, Bolt.EntityTargets.EveryoneExceptController);

        myEvent.WeaponOwner           = weaponOwner.entity;
        myEvent.BulletStartPos        = a_startPos;
        myEvent.BulletEndPos          = a_endPos;
        myEvent.BulletTrailPrefabId   = a_bulletTrailPrefabId;
        myEvent.FiringSoundName       = firingSound.name;
        myEvent.MuzzleFlashEffectName = muzzleFlashTPP.name;

        myEvent.Send();
    }