private void Explode(EventBody eb) { var em = ps.emission; var main = ps.main; main.startSpeed = 10; var collores = ps.colorOverLifetime; collores.color = new ParticleSystem.MinMaxGradient(Color.white); em.enabled = true; em.rateOverTime = 0; em.SetBursts( new ParticleSystem.Burst[] { new ParticleSystem.Burst(0.01f, 10, 20, 1, 0.01f) }); em.enabled = false; var av = Instantiate(attackVolume, transform.position, Quaternion.identity); av.transform.parent = transform; av.GetComponent <CircularAttackVolume>().currentTeam = team; exploding = true; }
// OnStateMove is called right after Animator.OnAnimatorMove(). Code that processes and affects root motion should be implemented here //override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { // //} // OnStateIK is called right after Animator.OnAnimatorIK(). Code that sets up animation IK (inverse kinematics) should be implemented here. //override public void OnStateIK(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { // //} private void Move(EventBody eb) { var xInput = ((AxisEB)eb).value; if (xInput < 0) { float targetSpeed = maxSpeedX * xInput; if (rb.velocity.x > targetSpeed) { rb.AddForce(Vector2.left * accelerationX); } localAnimator.SetBool("isFacingLeft", true); rend.flipX = true; //rb.AddForce(Vector2.left * 6); } else if (xInput > 0) { float targetSpeed = maxSpeedX * xInput; if (rb.velocity.x < targetSpeed) { rb.AddForce(Vector2.right * accelerationX); } localAnimator.SetBool("isFacingLeft", false); rend.flipX = false; //rb.AddForce(Vector2.right * 6); } // If 0 Then face same direction }
void RightMove1(EventBody eb) { if (p1CurrentSelection < playerOneChars.Length - 1) { p1CurrentSelection += 1; p1Selector.rectTransform.localPosition = playerOneChars[p1CurrentSelection].rectTransform.localPosition; } }
void LeftMove2(EventBody eb) { if (p2CurrentSelection > 0) { p2CurrentSelection -= 1; p2Selector.rectTransform.localPosition = playerTwoChars[p2CurrentSelection].rectTransform.localPosition; } }
void LeftMove1(EventBody eb) { if (p1CurrentSelection > 0) { p1CurrentSelection -= 1; p1Selector.rectTransform.localPosition = playerOneChars[p1CurrentSelection].rectTransform.localPosition; } }
public async Task SendEventAsync(string connectionId, EventBody eventBody) { Console.WriteLine("sendEventAsync received for {0} with body {1}", connectionId, eventBody.Body.ToString()); var client = objectMap[connectionId]; await client.SendEventAsync(new Microsoft.Azure.Devices.Client.Message(GlueUtils.ObjectToBytes(eventBody.Body))).ConfigureAwait(false); Console.WriteLine("sendEventAsync complete"); }
void RightMove2(EventBody eb) { if (p2CurrentSelection < playerTwoChars.Length - 1) { p2CurrentSelection += 1; p2Selector.rectTransform.localPosition = playerTwoChars[p2CurrentSelection].rectTransform.localPosition; } }
public void Reset(EventBody eb) { if (parent.ability2CooldownCurrent == 0) { EventManager.TriggerEvent("GloweyExplode", null); DeployedCount = 0; EventManager.TriggerEvent("Ability2_" + PlayerNumber + "_Triggered", null); } }
public static void TriggerEvent(string eventName, EventBody eventData) { GameEvent thisEvent = null; if (instance.eventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.Invoke(eventData); } }
void ActivateAB(EventBody eb) { if (gameObject.GetComponent <LittleGuy>().ability1CooldownCurrent <= 0f) { EventManager.TriggerEvent("Ability1_" + PlayerNumber + "_Triggered", null); gameObject.GetComponent <Rigidbody2D>().AddForce(force * aim); ps.Stop(); ps.Play(); } }
public void TestMarshallBody() { var body = CreateDummyEventBody(); var raw = body.Marshal(); var newBody = EventBody.Unmarshal(raw); newBody.ShouldCompareTo(body); }
private void RestartGame(EventBody eb) { var teaminfo = FindObjectOfType <TeamInformation>(); if (teaminfo != null) { Destroy(teaminfo); } SceneManager.LoadScene("CharacterSelect"); }
void BeginTheKilling(EventBody eb) { if (weReady) { teamInfo.GetComponent <TeamInformation>().p1Selections = p1Selections; teamInfo.GetComponent <TeamInformation>().p2Selections = p2Selections; //lets begin... SceneManager.LoadScene("BackupLevelUI"); } }
public async Task <(Event ev, Exception err)> ReadWireInfo(WireEvent wev) { var selfParent = ""; var otherParent = ""; Exception err; var creator = ReverseParticipants[wev.Body.CreatorId]; var creatorBytes = creator.FromHex(); if (wev.Body.SelfParentIndex >= 0) { (selfParent, err) = await Store.ParticipantEvent(creator, wev.Body.SelfParentIndex); if (err != null) { return(null, err); } } if (wev.Body.OtherParentIndex >= 0) { var otherParentCreator = ReverseParticipants[wev.Body.OtherParentCreatorId]; (otherParent, err) = await Store.ParticipantEvent(otherParentCreator, wev.Body.OtherParentIndex); if (err != null) { return(null, err); } } var body = new EventBody { Transactions = wev.Body.Transactions, BlockSignatures = wev.BlockSignatures(creatorBytes), Parents = new[] { selfParent, otherParent }, Creator = creatorBytes, Timestamp = wev.Body.Timestamp, Index = wev.Body.Index }; body.SetSelfParentIndex(wev.Body.SelfParentIndex); body.SetOtherParentCreatorId(wev.Body.OtherParentCreatorId); body.SetOtherParentIndex(wev.Body.OtherParentIndex); body.SetCreatorId(wev.Body.CreatorId); var ev = new Event { Body = body, Signiture = wev.Signiture }; return(ev, null); }
private static EventBody CreateDummyEventBody() { var body = new EventBody { Transactions = new[] { "abc".StringToBytes(), "def".StringToBytes() }, Parents = new[] { "self", "other" }, Creator = "public key".StringToBytes(), Timestamp = DateTime.MinValue }; return(body); }
public void TestConstructor() { var expectedType = typeof(string); var expectedData = "data"; var subject = new EventBody (expectedType, expectedData); subject.EventType.Should ().NotBeNull (); subject.EventType.Should ().Be<string> (); subject.EventData.Should ().NotBeNull (); subject.EventData.Should ().Be (expectedData); }
void FaintLittleGuy(EventBody eb) { Teams team = ((TeamFaintEB)eb).team; if (team == Teams.TeamOne) { team1Alive -= 1; } else if (team == Teams.TeamTwo) { team2Alive -= 1; } }
void ActivateAB(EventBody eb) { if (gameObject.GetComponent <LittleGuy>().ability2CooldownCurrent <= 0f) { EventManager.TriggerEvent("Ability2_" + PlayerNumber + "_Triggered", null); GameObject tempAV = (GameObject)Instantiate(av, gameObject.transform.position + new Vector3(0f, -0.18f, 0f), Quaternion.identity, gameObject.transform); tempAV.GetComponent <AttackVolume>().currentTeam = gameObject.GetComponent <LittleGuy>().CurrentTeam; tempAV.SetActive(true); Destroy(tempAV, durration); ps.Stop(); ps.Play(); } }
void ActivateAB(EventBody eb) { if (gameObject.GetComponent <LittleGuy>().ability2CooldownCurrent <= 0f) { EventManager.TriggerEvent("Ability2_" + PlayerNumber + "_Triggered", null); GameObject petalys = (GameObject)Instantiate(petal, gameObject.transform.position, Quaternion.identity); //Debug.Log(Mathf.Atan2(aim.y, aim.x)); petalys.GetComponent <HomingRocket>().currentTeam = gameObject.GetComponent <LittleGuy>().CurrentTeam; Destroy(petalys, range); } }
public void Activate(EventBody Eb) { if (parent.ability1CooldownCurrent == 0) { if (DeployedCount < DeployedMax) { var glowey = Instantiate(Glowey, gameObject.transform.position, Quaternion.identity); glowey.GetComponent <GloweyExplode>().team = GetComponent <LittleGuy>().CurrentTeam; DeployedCount = DeployedCount + 1; EventManager.TriggerEvent("Ability1_" + PlayerNumber + "_Triggered", null); } } }
void IncrementPoints(EventBody eb) { Teams team = ((PointsEB)eb).team; float points = ((PointsEB)eb).points; if (team == Teams.TeamOne) { pointsT1 += points; } else if (team == Teams.TeamTwo) { pointsT2 += points; } }
private static EventBody CreateDummyEventBody() { var body = new EventBody { Transactions = new[] { "abc".StringToBytes(), "def".StringToBytes() }, Parents = new[] { "self", "other" }, Creator = "public key".StringToBytes(), Timestamp = DateTimeOffset.UtcNow, }; body.BlockSignatures = new[] { new BlockSignature() { Validator = body.Creator, Index = 0, Signature = "r|s".StringToBytes() } }; return(body); }
void ActivateAB(EventBody eb) { if (gameObject.GetComponent <LittleGuy>().ability2CooldownCurrent <= 0f) { float vpoints = 0f; if (PlayerNumber == 1) { vpoints = GameObject.Find("Game Manage").GetComponent <GameManage>().pointsT1; } else { vpoints = GameObject.Find("Game Manage").GetComponent <GameManage>().pointsT2; } if (vpoints > 3) { if (PlayerNumber == 1) { EventManager.TriggerEvent("IncrementPoints", new PointsEB { team = Teams.TeamOne, points = -3f }); } else { EventManager.TriggerEvent("IncrementPoints", new PointsEB { team = Teams.TeamTwo, points = -3f }); } EventManager.TriggerEvent("Ability2_" + PlayerNumber + "_Triggered", null); GameObject tempAV = (GameObject)Instantiate(seed, gameObject.transform.position, Quaternion.identity); if (PlayerNumber == 1) { tempAV.GetComponent <WallSeed>().currentTeam = Teams.TeamOne; } else { tempAV.GetComponent <WallSeed>().currentTeam = Teams.TeamTwo; } tempAV.GetComponent <WallSeed>().triggerTime = triggerTime; tempAV.GetComponent <WallSeed>().durration = durration; //Destroy(tempAV, durration); } } }
void Damage(EventBody eb) { float damage = ((DamageEB)eb).damage; Statistics.GetAttribute(AttributeTypes.Health).currentValue -= damage; if (Statistics.GetAttribute(AttributeTypes.Health).currentValue > Statistics.GetAttribute(AttributeTypes.Health).maxValue) { Statistics.GetAttribute(AttributeTypes.Health).currentValue = Statistics.GetAttribute(AttributeTypes.Health).maxValue; } if (Statistics.GetAttribute(AttributeTypes.Health).currentValue <= 0f) { GetComponent <Animator>().SetTrigger("Death"); EventManager.TriggerEvent("Death", new DeathEB { entity = gameObject }); } }
public void TestMarshallBody() { var body = CreateDummyEventBody(); var raw = body.Marshal(); var newBody = EventBody.Unmarshal(raw); newBody.ShouldCompareTo(body); newBody.Transactions.ShouldCompareTo(body.Transactions); newBody.BlockSignatures.ShouldCompareTo(body.BlockSignatures); newBody.Parents.ShouldCompareTo(body.Parents); newBody.Creator.ShouldCompareTo(body.Creator); Assert.Equal(body.Timestamp, newBody.Timestamp); }
void ActivateAB(EventBody eb) { if (gameObject.GetComponent <LittleGuy>().ability1CooldownCurrent <= 0f) { EventManager.TriggerEvent("Ability1_" + PlayerNumber + "_Triggered", null); if (aim == Vector2.zero) { aim = new Vector2(0f, -1f); } GameObject petalys = (GameObject)Instantiate(petal, gameObject.transform.position, Quaternion.Euler(0f, 0f, Mathf.Atan2(aim.y, aim.x) * Mathf.Rad2Deg - 90f)); //Debug.Log(Mathf.Atan2(aim.y, aim.x)); petalys.GetComponent <Rigidbody2D>().AddForce(force * aim); petalys.GetComponent <PetalMove>().currentTeam = gameObject.GetComponent <LittleGuy>().CurrentTeam; Destroy(petalys, range); gameObject.GetComponent <Rigidbody2D>().AddForce(-force * aim); } }
void Select1(EventBody eb) { if (!p1Selections.Contains(p1CurrentSelection) && p1Selections.Count < 3) { p1Selections.Add(p1CurrentSelection); if (p1Selections.Count == 1) { p1Selection1.rectTransform.localPosition = playerOneChars[p1CurrentSelection].rectTransform.localPosition; } else if (p1Selections.Count == 2) { p1Selection2.rectTransform.localPosition = playerOneChars[p1CurrentSelection].rectTransform.localPosition; } else if (p1Selections.Count == 3) { p1Selection3.rectTransform.localPosition = playerOneChars[p1CurrentSelection].rectTransform.localPosition; } } }
void Select2(EventBody eb) { if (!p2Selections.Contains(p2CurrentSelection) && p2Selections.Count < 3) { p2Selections.Add(p2CurrentSelection); if (p2Selections.Count == 1) { p2Selection1.rectTransform.localPosition = playerTwoChars[p2CurrentSelection].rectTransform.localPosition; } else if (p2Selections.Count == 2) { p2Selection2.rectTransform.localPosition = playerTwoChars[p2CurrentSelection].rectTransform.localPosition; } else if (p2Selections.Count == 3) { p2Selection3.rectTransform.localPosition = playerTwoChars[p2CurrentSelection].rectTransform.localPosition; } } }
private void HandleDeath(EventBody eb) { var deadGuy = ((DeathEB)eb).entity; var littleDeadGuy = deadGuy.GetComponent <LittleGuy>(); if (littleDeadGuy.CurrentTeam == Teams.TeamOne) { Team1.Remove(deadGuy); Destroy(deadGuy); Team1Current = 0; if (Team1.Count > 0) { Team1.First <GameObject>().SetActive(true); } /*if (Team1[Team1Current]) * { * Team1[Team1Current].SetActive(true); * }*/ } else if (littleDeadGuy.CurrentTeam == Teams.TeamTwo) { Team2.Remove(deadGuy); Destroy(deadGuy); Team2Current = 0; if (Team2.Count > 0) { Team2.First <GameObject>().SetActive(true); } /*if (Team2[Team2Current]) * { * Team2[Team2Current].SetActive(true); * }*/ } EventManager.TriggerEvent("FaintLittleGuy", new TeamFaintEB { team = littleDeadGuy.CurrentTeam }); }
public async Task <int> CreateEvent(EventBody eventBody, int locationId, int organiserId) { // save image to blob string imageName = await azureService.saveImageToBlobStorage(eventBody.Image); // create new event Event newEvent = new Event { Title = eventBody.Title, Description = eventBody.Description, StartTime = eventBody.StartTime, OrganisorId = organiserId, Image = imageName, MaxRegistrations = eventBody.MaxRegistrations, LocationId = locationId }; // save event await eventRepository.CreateAsync(newEvent); return(newEvent.Id); }
public async Task <Event> UpdateEvent(EventBody eventBody, int locationId, int eventId) { // get the current event Event oldEvent = await eventRepository.ReadAsync(eventId); // if the event was not found within location if (oldEvent.LocationId != locationId) { return(null); } // create updated event Event updateEvent = new Event { Id = eventId, Title = eventBody.Title, Description = eventBody.Description, MaxRegistrations = eventBody.MaxRegistrations, StartTime = eventBody.StartTime }; if (eventBody.Image != null) { // save image to blob string url = await azureService.saveImageToBlobStorage(eventBody.Image); updateEvent.Image = url; // delete old image azureService.deleteImageFromBlobStorage(oldEvent.Image); } // save event to database Event updatedEvent = await eventRepository.UpdateAsync(updateEvent); return(updatedEvent); }