Ejemplo n.º 1
0
 public static void IsolateLabelMaskGroup(int groupId)
 {
     if (groupId == 0)
     {
         LabelMaskCoordinator.SetAllStates(true);
     }
     else
     {
         LabelMaskCoordinator.SetAllStates(false);
         if (groupId == 1)
         {
             Instance.EnableLabelGroup(LabelsBucket.BuildingLabels);
         }
         if (groupId == 2)
         {
             Instance.EnableLabelGroup(LabelsBucket.FurnitureLabels);
         }
         if (groupId == 3)
         {
             Instance.EnableLabelGroup(LabelsBucket.ItemLabels);
         }
         if (groupId == 4)
         {
             Instance.EnableLabelGroup(LabelsBucket.AnimalsLabels);
         }
     }
     EventCoordinator.TriggerEvent(EventName.UI.LabelMaskChanged(), GameMessage.Write());
 }
Ejemplo n.º 2
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.S))
     {
         EventCoordinator.TriggerEvent(EventName.Input.StartGame(), GameMessage.Write().WithStringMessage("yay"));
     }
 }
Ejemplo n.º 3
0
    IEnumerator Attack()
    {
        isChasing = false;
        animator.SetInteger("state", 3);
        // Attack animation
        float startTime = Time.time;

        agent.isStopped = true;
        do
        {
            if (target == null)
            {
                StartCoroutine(Wait());
                yield break;
            }

            if (isChasing)
            {
                yield break;
            }

            yield return(null);
        }while (startTime + attackTime > Time.time);

        if (target != null && CanAttack(target))
        {
            Debug.Log("hit");
            EventCoordinator.TriggerEvent(EventName.System.Environment.Damage(), GameMessage.Write().WithTargetTransform(target));
        }
        Reevaluate();
    }
Ejemplo n.º 4
0
    void Fire()
    {
        timer = 0;
        ProjectileBase projB = Instantiate(projectile, spawnpoint.position, spawnpoint.rotation).GetComponent <ProjectileBase>();

        projB.Velocity = spawnpoint.forward * musVelocity;
        projB.Damage   = damage;
        projB.DmgType  = type;
        currentAmmo   -= 1;
        if (hitAudioSources != null && hitAudioSources.Length > 0)
        {
            projB.audioSource = hitAudioSources[currentHitAudio];
        }
        if (hitAudioSources.Length == ++currentHitAudio)
        {
            currentHitAudio = 0;
        }
        if (audio.isPlaying)
        {
            audio.Stop();
        }
        audio.Play();
        ParticleEventInfo psei = new ParticleEventInfo(gameObject, "Particles", fireParticles, spawnpoint.position, spawnpoint.rotation);

        EventCoordinator.ActivateEvent(psei);
        //SoundEventInfo sei = new SoundEventInfo(gameObject, "Firesound", fireSound, spawnpoint.position);
        //EventCoordinator.ActivateEvent(sei);
    }
Ejemplo n.º 5
0
 protected override void OnHealthDamageTaken(HealthComponent bodyPart, float damageTaken, Transform damageOriginPosition)
 {
     if (CurrentHealth < (MaxHealth * 0.75f) && CurrentHealth > (MaxHealth * 0.5f))
     {
         stationLightDamage.Invoke();
     }
     else if (CurrentHealth < (MaxHealth * 0.5f) && CurrentHealth > (MaxHealth * 0.25f))
     {
         stationModerateDamage.Invoke();
     }
     else if (CurrentHealth < (MaxHealth * 0.25f) && CurrentHealth > 0)
     {
         stationHeavyDamage.Invoke();
     }
     else if (CurrentHealth <= 0.0f)
     {
         stationDestroyedEvent.Invoke();
         LaneTargetDestroyedEventInfo ltdei = new LaneTargetDestroyedEventInfo(gameObject, this);
         EventCoordinator.ActivateEvent(ltdei);
         ParticleEventInfo psei = new ParticleEventInfo(gameObject, "Particles", DestroyedParticles, transform.position, transform.rotation);
         EventCoordinator.ActivateEvent(psei);
         TextLogEventInfo tlei = new TextLogEventInfo(gameObject, name + " has been destroyed!");
         EventCoordinator.ActivateEvent(tlei);
         VoiceLineEventInfo vlei = new VoiceLineEventInfo(gameObject, deathVoiceline);
         EventCoordinator.ActivateEvent(vlei);
     }
 }
Ejemplo n.º 6
0
    void Start()
    {
        image            = GetComponent <Image>();
        image.fillAmount = 1;

        EventCoordinator.StartListening(EventName.System.Environment.GoblinGotDamage(), OnGoblinGotDamage);
    }
Ejemplo n.º 7
0
 void Start()
 {
     if (GameStateView.HasState(GameState.gameReloaded))
     {
         EventCoordinator.TriggerEvent(EventName.System.SceneLoaded(), GameMessage.Write());
     }
 }
Ejemplo n.º 8
0
 // Start is called before the first frame update
 void Start()
 {
     startPos = transform.position;
     timelaps = 1 / timeToClose;
     EventCoordinator.RegisterEventListener <GateDestroyedEventInfo>(Destroyed);
     EventCoordinator.RegisterEventListener <AdjustDoorEventInfo>(AdjustDoor);
 }
Ejemplo n.º 9
0
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Company,Address,State,Zip,PhoneNumber")] EventCoordinator eventCoordinator)
        {
            if (ModelState.IsValid)
            {
                if (eventCoordinator.Id == 0)
                {
                    var userId = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
                    eventCoordinator.IdentityUserId = userId;
                    _context.Add(eventCoordinator);
                }
                else
                {
                    var eventCoordinatorInDB = _context.EventCoordinators.Single(m => m.Id == eventCoordinator.Id);
                    eventCoordinatorInDB.FirstName   = eventCoordinator.FirstName;
                    eventCoordinatorInDB.LastName    = eventCoordinator.LastName;
                    eventCoordinatorInDB.Company     = eventCoordinator.Company;
                    eventCoordinatorInDB.Address     = eventCoordinator.Address;
                    eventCoordinatorInDB.State       = eventCoordinator.State;
                    eventCoordinatorInDB.ZipCode     = eventCoordinator.ZipCode;
                    eventCoordinatorInDB.PhoneNumber = eventCoordinator.PhoneNumber;
                }
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdentityUserId"] = new SelectList(_context.Users, "Id", "Id", eventCoordinator.IdentityUserId);
            return(View(eventCoordinator));
        }
Ejemplo n.º 10
0
    IEnumerator PickUpLoot()
    {
        animator.SetInteger("state", 2);
        // PickUp animation
        float startTime = Time.time;

        do
        {
            if (target == null)
            {
                StartCoroutine(Wait());
                yield break;
            }

            if (isChasing)
            {
                yield break;
            }

            yield return(null);
        }while (startTime + pickUpTime > Time.time);

        Debug.Log("pick up");
        EventCoordinator.TriggerEvent(EventName.System.Environment.PickUpLoot(), GameMessage.Write().WithTargetTransform(target));
        Reevaluate();
    }
Ejemplo n.º 11
0
 // Start is called before the first frame update
 void Start()
 {
     agent    = GetComponent <NavMeshAgent>();
     animator = GetComponentInChildren <Animator>();
     StartCoroutine(Wait());
     EventCoordinator.StartListening(EventName.Input.Player.StartChannelingPortal(), OnStartPortal);
 }
Ejemplo n.º 12
0
 void OnResourceChanged(GameMessage msg)
 {
     if (PlayerDataBucket.IsAnyResourceEmpty())
     {
         EventCoordinator.TriggerEvent(EventName.System.EndGame(), GameMessage.Write());
     }
 }
Ejemplo n.º 13
0
 void Start()
 {
     EventCoordinator.StartListening(EventName.Input.StartGame(), OnGameStart);
     EventCoordinator.StartListening(EventName.Input.ResetGame(), OnGameReset);
     EventCoordinator.StartListening(EventName.System.EndGame(), OnEndGame);
     GameLaunched();
 }
Ejemplo n.º 14
0
    private IEnumerator TeleportPlayer()
    {
        TeleportationDoneEventInfo tdei = new TeleportationDoneEventInfo(gameObject);

        EventCoordinator.ActivateEvent(tdei);
        mechMovement.Teleporting = true;
        timer     = 0;
        posOffset = transform.position - mech.transform.position;
        while (teleporting)
        {
            while (!closed)
            {
                closeTheDoor();
                timer += Time.deltaTime;
                yield return(null);
            }
            timer = 0;
            mech.transform.position = destination.position - posOffset;
            while (closed)
            {
                openTheDoor();
                timer += Time.deltaTime;
                yield return(null);
            }
            teleporting = false;
        }
        mechMovement.Teleporting = false;
        timer = 0;
    }
Ejemplo n.º 15
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.KeypadPlus))
     {
         EventCoordinator.TriggerEvent(EventName.System.Economy.ModifyResource(), GameMessage.Write().WithFloatMessage(1.5f).WithResource(ResourceItem.Ductape));
         EventCoordinator.TriggerEvent(EventName.System.Economy.ModifyResource(), GameMessage.Write().WithFloatMessage(-1.5f).WithResource(ResourceItem.Wd));
     }
     if (Input.GetKeyDown(KeyCode.Keypad1))
     {
         EventCoordinator.TriggerEvent(EventName.System.Story.UnlockEnding(), GameMessage.Write().WithIntMessage(1));
     }
     if (Input.GetKeyDown(KeyCode.Keypad2))
     {
         EventCoordinator.TriggerEvent(EventName.System.Story.UnlockEnding(), GameMessage.Write().WithIntMessage(2));
     }
     if (Input.GetKeyDown(KeyCode.Keypad3))
     {
         EventCoordinator.TriggerEvent(EventName.System.Story.UnlockEnding(), GameMessage.Write().WithIntMessage(3));
     }
     if (Input.GetKeyDown(KeyCode.E))
     {
         EventCoordinator.TriggerEvent(EventName.System.EndGame(), GameMessage.Write());
     }
     if (Input.GetKeyDown(KeyCode.Delete))
     {
         ClearSaves();
     }
 }
Ejemplo n.º 16
0
 void Start()
 {
     // TODO: move out of CardFactory
     EventCoordinator.StartListening(EventName.Input.Swipe.FinishRight(), OnSwipeRight);
     EventCoordinator.StartListening(EventName.Input.Swipe.FinishLeft(), OnSwipeLeft);
     EventCoordinator.StartListening(EventName.System.MatchStarted(), OnMatchStarted);
 }
Ejemplo n.º 17
0
        // GET: EventCoordinatorsController/Create
        public IActionResult Create()
        {
            EventCoordinator eventCoordinator = new EventCoordinator();

            ViewData["IdentityUserId"] = new SelectList(_context.Users, "Id", "Id");
            return(View(eventCoordinator));
        }
Ejemplo n.º 18
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.P))
     {
         DetatchArmorEventInfo daei = new DetatchArmorEventInfo(gameObject, "Detach armor plate");
         EventCoordinator.ActivateEvent(daei);
     }
 }
Ejemplo n.º 19
0
 public void OnEnemyDeath(EnemyDiedEvent enemyDiedEvent)
 {
     enemiesLeftToKill--;
     if (enemiesLeftToKill <= 0)
     {
         EventCoordinator.FireEvent(new WaveClearedEvent());
     }
 }
Ejemplo n.º 20
0
 private void OnDestroy()
 {
     if (!malfunction)
     {
         EventCoordinator.UnregisterEventListener <CoolingSystemMalfunctionEventInfo>(Malfunction);
         EventCoordinator.UnregisterEventListener <IncreaseHeatEventInfo>(IncreaseHeat);
     }
 }
Ejemplo n.º 21
0
 void Start()
 {
     if (rend == null)
     {
         rend = GetComponentInChildren <SpriteRenderer>();
     }
     EventCoordinator.StartListening(EventName.System.Economy.PortalProgress(), OnProgress);
 }
Ejemplo n.º 22
0
    void OnModifyResource(GameMessage msg)
    {
        bool   goodSelected = msg.cardData.correctResrouce == msg.resourceItem;
        Answer answer       = msg.cardData.answers.Where(x => x.good == goodSelected && x.resource == msg.resourceItem).FirstOrDefault();
        float  amount       = answer.cost;

        EventCoordinator.TriggerEvent(EventName.System.Economy.ModifyResource(), GameMessage.Write().WithResource(msg.resourceItem).WithFloatMessage(-amount));
    }
Ejemplo n.º 23
0
 void OnDestroy()
 {
     SceneManager.sceneLoaded -= OnSceneLoading;
     EventCoordinator.StopListening(EventName.Input.StartGame(), OnStartGame);
     EventCoordinator.StopListening(EventName.System.Environment.EndMatch(), OnEndGame);
     EventCoordinator.StopListening(EventName.System.Environment.CleanScene(), OnSceneClean);
     EventCoordinator.StopListening(EventName.System.SceneLoaded(), OnSceneLoaded);
 }
Ejemplo n.º 24
0
 private void OnDestroy()
 {
     EventCoordinator.UnregisterEventListener <ReactorOverchargeBeginEventInfo>(OverChargeReactorStart);
     EventCoordinator.UnregisterEventListener <ReactorOverchargeEndEventInfo>(OverChargeReactorStop);
     EventCoordinator.UnregisterEventListener <TransferToMainHeatSinkEventInfo>(AddDrainedHeat);
     EventCoordinator.UnregisterEventListener <FlushCoolantEventInfo>(FlushCoolant);
     EventCoordinator.RegisterEventListener <CoolantRefillStatusEventInfo>(RefillCoolant);
 }
Ejemplo n.º 25
0
 static void Main(string[] args)
 {
     eCoord = new EventCoordinator(200, 1000, 100, 5000, 300, 5000);
     runProgram();
     Console.WriteLine("Thank you for using Eventie.io");
     Console.WriteLine("Press any key to exit.");
     Console.ReadKey();
 }
Ejemplo n.º 26
0
 void Start()
 {
     EventCoordinator.RegisterEventListener <PickUpEventInfo>(MechActivation);
     EventCoordinator.RegisterEventListener <DropItemEventInfo>(MechDeactivation);
     cameraTransform = Camera.main.transform;
     mech.rotation   = Quaternion.Euler(0, cameraTransform.rotation.eulerAngles.y, 0);
     joysticksteering.actionSet.Activate();
 }
Ejemplo n.º 27
0
 public static void TakeCommand(int requestedCommand)
 {
     currentCommand += requestedCommand;
     if (currentCommand > commandLimit)
     {
         Debug.LogError("We have exceeded our command limit.");
     }
     EventCoordinator.FireEvent(new CommandForceChangedEvent(requestedCommand, currentCommand));
 }
    private void ActivateMech(GameObject other)
    {
        grabbed          = true;
        parent           = transform.parent;
        transform.parent = other.transform;
        PickUpEventInfo amei = new PickUpEventInfo(gameObject, "Sending an activate mech event", hand);

        EventCoordinator.ActivateEvent(amei);
    }
    private void DeactivateMech()
    {
        grabbed          = false;
        transform.parent = parent;
        moveTowardsStartPos();
        DropItemEventInfo dmei = new DropItemEventInfo(gameObject, "Sending an activate mech event", hand);

        EventCoordinator.ActivateEvent(dmei);
    }
Ejemplo n.º 30
0
 public override void Shoot()
 {
     if (spawnedLaser == null)
     {
         FireLaser();
     }
     EventCoordinator.FireEvent(new DamageEvent(this, enemiesInRange[0], AttackDamage, Health.DamageType.Energy));
     PowerGrid.ConsumePower(PowerDraw);
 }
Ejemplo n.º 31
0
 public EventCoordinator SaveCoordinator(EventCoordinator validCoordinator)
 {
     return ValidateAndSave(validCoordinator);
 }
Ejemplo n.º 32
0
 public void SaveCoordinatorSuccess()
 {
     SetupSaveCoordinatorSuccess();
     var validCoordinator = new EventCoordinator { Coordinator = new User(), Event = new Event(), Status = Entities.Enumerations.EventMemberStatus.Requested };
     ValidateSuccessfulEntityCreation(_eventService.SaveCoordinator(validCoordinator));
 }
Ejemplo n.º 33
0
 protected AggregateRootBase(EventCoordinator eventCoordinator)
     : base(eventCoordinator.AggregateRootId,eventCoordinator)
 {
 }
Ejemplo n.º 34
0
 public void SaveCoordinatorFailure()
 {
     SetupSaveCoordinatorFailure();
     var invalidCoordinator = new EventCoordinator { Coordinator = null, Event = null};
     ValidateUnsuccessfulEntityCreation(_eventService.SaveCoordinator(invalidCoordinator));
 }