public void FireIonBeam() { if (!_isFiring && entity.isOwner) { Vector3 camPosition = _ionBeamCam.transform.position; _ionBeamCam.GetComponent <IonBeamCamera>().enabled = false; _ionBeamCam.GetComponentInChildren <Camera>().enabled = false; var ionBeamLaser = BoltNetwork.Instantiate(ionBeamLaserPrefab, new Vector3(camPosition.x, 0, camPosition.z), Quaternion.identity); var itemState = ionBeamLaser.GetComponent <BoltEntity>().GetState <IItemState>(); itemState.OwnerID = _ionBeamOwnership.OwnerID; var laserOwnership = ionBeamLaser.GetComponent <Ownership>(); laserOwnership.Label = _ionBeamOwnership.Label; laserOwnership.OwnerID = _ionBeamOwnership.OwnerID; laserOwnership.OwnerNickname = _ionBeamOwnership.OwnerNickname; laserOwnership.Team = _ionBeamOwnership.Team; ItemThrown itemThrownEvent = ItemThrown.Create(); itemThrownEvent.OwnerNickname = _ionBeamOwnership.OwnerNickname; itemThrownEvent.OwnerID = _ionBeamOwnership.OwnerID; itemThrownEvent.Team = (int)_ionBeamOwnership.Team; itemThrownEvent.Entity = ionBeamLaser; itemThrownEvent.Send(); ionBeamLaser.transform.position = new Vector3(_ionBeamCam.transform.position.x, ionBeamLaser.transform.position.y, _ionBeamCam.transform.position.z); _ionBeamCam.IonBeamCameraBehaviour(false); if (entity.isOwner) { StartCoroutine(DelayBeforeInputsChange()); } _isFiring = true; } }
public override void OnEvent(ItemThrown evnt) { if (evnt.Entity == GetComponent <BoltEntity>()) { SetMode(evnt.UsageMode); } }
// PRIVATE private void InstantiateItem() { var instantiatedItem = BoltNetwork.Instantiate(CurrentItem.ItemPrefab, transform.position + transform.forward, transform.rotation); int usableMode; if (_throwingDirection.LastDirectionUp == Direction.Backward) { usableMode = 2; } else { usableMode = 1; } if (IsWallDetected) { usableMode = 10; } ItemThrown itemThrownEvent = ItemThrown.Create(); itemThrownEvent.OwnerNickname = GetComponentInParent <PlayerInfo>().Nickname; itemThrownEvent.OwnerID = state.OwnerID; itemThrownEvent.Team = state.Team; itemThrownEvent.Entity = instantiatedItem; itemThrownEvent.UsageMode = usableMode; var itemOwnership = instantiatedItem.GetComponent <Ownership>(); if (itemOwnership) { itemOwnership.Label = CurrentItem.Name; itemOwnership.Set(GetComponentInParent <PlayerInfo>()); itemThrownEvent.ItemName = itemOwnership.Label; } var throwable = instantiatedItem.GetComponent <Throwable>(); if (throwable) { _projectileLauncher.Throw(throwable, _throwingDirection.LastDirectionUp); } /* * var usable = instantiatedItem.GetComponent<MultiModeUsable>(); * if (usable) * { * if (_throwingDirection.LastDirectionUp == Direction.Backward) * { * usable.SetMode(2); * } * else * { * usable.SetMode(1); * } * } */ itemThrownEvent.Send(); }
public void OnItemThrown(ItemThrown e) { //Item clicked on Debug.Log(throwndesccount); description.text = throwndescriptions[throwndesccount]; OpenPanel(); Item = e.Item; if (throwndesccount < throwndescriptions.Length - 1) { throwndesccount += 1; } }
public override void OnEvent(ItemThrown evnt) { if (evnt.Entity == GetComponent <BoltEntity>()) { Label = evnt.ItemName; OwnerID = evnt.OwnerID; OwnerNickname = evnt.OwnerNickname; Team = evnt.Team.ToTeam(); OwnerKartRoot = SWExtensions.KartExtensions.GetKartWithID(OwnerID); OnOwnershipSet.Invoke(OwnerKartRoot); } }
public void LaunchImmediateIonBeamBackwards(Vector3 position) { var ionBeamLaser = BoltNetwork.Instantiate(ionBeamLaserPrefab, position, Quaternion.identity); var itemState = ionBeamLaser.GetComponent <BoltEntity>().GetState <IItemState>(); itemState.OwnerID = state.OwnerID; var laserOwnership = ionBeamLaser.GetComponent <Ownership>(); laserOwnership.Label = _ionBeamOwnership.Label; laserOwnership.OwnerID = _ionBeamOwnership.OwnerID; laserOwnership.OwnerNickname = _ionBeamOwnership.OwnerNickname; laserOwnership.Team = _ionBeamOwnership.Team; ItemThrown itemThrownEvent = ItemThrown.Create(); itemThrownEvent.OwnerNickname = _ionBeamOwnership.OwnerNickname; itemThrownEvent.OwnerID = _ionBeamOwnership.OwnerID; itemThrownEvent.Team = (int)_ionBeamOwnership.Team; itemThrownEvent.Entity = ionBeamLaser; itemThrownEvent.Send(); ionBeamLaser.transform.position = position; }