Пример #1
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;
    }
Пример #2
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);
    }
Пример #3
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);
     }
 }
Пример #4
0
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.P))
     {
         DetatchArmorEventInfo daei = new DetatchArmorEventInfo(gameObject, "Detach armor plate");
         EventCoordinator.ActivateEvent(daei);
     }
 }
    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);
    }
Пример #7
0
    void TransferHeatToMainHeatSink()
    {
        float ammount = currentHeat - ammountDrained;

        if (ammount > 0)
        {
            ammountDrained += ammount;
        }
        TransferToMainHeatSinkEventInfo thtmsei = new TransferToMainHeatSinkEventInfo(gameObject, ammount);

        EventCoordinator.ActivateEvent(thtmsei);
    }
Пример #8
0
 // Update is called once per frame
 void Update()
 {
     if (active)
     {
         float distance = (agent.destination - transform.position).magnitude;
         if (distance < repairDistance && !repairing)
         {
             StartDroneRepairEventInfo sdrei = new StartDroneRepairEventInfo(gameObject, targetToRepair, repairSpeed);
             EventCoordinator.ActivateEvent(sdrei);
             repairing = true;
         }
         else if (repairing)
         {
             mesh.transform.RotateAround(rotatePoint.position, Vector3.up, 2);
         }
     }
 }
Пример #9
0
    // Update is called once per frame
    void Update()
    {
        timer += Time.deltaTime;

        if (currentHeat > heatSinkCapacity && !overHeated)
        {
            overHeated = true;
            TransferHeatToMainHeatSink();
            OverHeatedEventInfo ohei = new OverHeatedEventInfo(gameObject, "Overheat", true);
            EventCoordinator.ActivateEvent(ohei);
        }
        else if (timer > timeBetweenCheck && !overHeated)
        {
            timer = 0;
            TransferHeatToMainHeatSink();
        }

        if (ammountDrained > 0)
        {
            PassiveDrain();
        }
    }
Пример #10
0
    void Update()
    {
        if (player != null)
        {
            Debug.Log(player.transform.position + " : " + playerPos);
            timer += Time.deltaTime;
            if (player.transform.position != playerPos)
            {
                Debug.Log("player Moved");
                moved     = true;
                playerPos = player.transform.position;
            }
            else
            {
                moved = false;
                Debug.Log("player not moving");
            }

            if (moved)
            {
                timer = 0;
                if (refilling)
                {
                    station.GetComponent <MeshRenderer>().material = standardMat;
                    CoolantRefillStatusEventInfo crsei = new CoolantRefillStatusEventInfo(gameObject, false, 0);
                    EventCoordinator.ActivateEvent(crsei);
                }
            }

            if (timer > timeBeforeActivate && !refilling)
            {
                station.GetComponent <MeshRenderer>().material = refillMat;
                CoolantRefillStatusEventInfo crsei = new CoolantRefillStatusEventInfo(gameObject, true, coolantPerSecond);
                EventCoordinator.ActivateEvent(crsei);
                refilling = true;
            }
        }
    }
Пример #11
0
    void PassiveDrain()
    {
        float drained = passiveDraining * Time.deltaTime;

        if (overHeated)
        {
            currentHeat    -= drained * flushingMultiplier;
            ammountDrained -= drained * flushingMultiplier;
            if (currentHeat <= 0)
            {
                currentHeat    = 0;
                ammountDrained = 0;
                overHeated     = false;
                OverHeatedEventInfo ohei = new OverHeatedEventInfo(gameObject, "Not Overheat", false);
                EventCoordinator.ActivateEvent(ohei);
            }
        }
        else
        {
            currentHeat    -= drained;
            ammountDrained -= drained;
        }
    }
Пример #12
0
    private void ActivateCoolantRefill()
    {
        CoolantRefillStatusEventInfo crsei = new CoolantRefillStatusEventInfo(gameObject, true, cooling);

        EventCoordinator.ActivateEvent(crsei);
    }
Пример #13
0
    public void FlushCoolant()
    {
        FlushCoolantEventInfo fcei = new FlushCoolantEventInfo(gameObject);

        EventCoordinator.ActivateEvent(fcei);
    }
Пример #14
0
    private void SystemMalfunction()
    {
        CoolingSystemMalfunctionEventInfo csm = new CoolingSystemMalfunctionEventInfo(gameObject, "Shut it down");

        EventCoordinator.ActivateEvent(csm);
    }
Пример #15
0
    private void SendTextToUI(string name)
    {
        DebugEventInfo dei = new DebugEventInfo(gameObject, name, 0);

        EventCoordinator.ActivateEvent(dei);
    }
Пример #16
0
    public void DestroyedGate()
    {
        GateDestroyedEventInfo gdei = new GateDestroyedEventInfo(gameObject, "Destroyed");

        EventCoordinator.ActivateEvent(gdei);
    }
Пример #17
0
    private void DeactivateCoolantRefill()
    {
        CoolantRefillStatusEventInfo crsei = new CoolantRefillStatusEventInfo(gameObject, false, 0);

        EventCoordinator.ActivateEvent(crsei);
    }