Ejemplo n.º 1
0
    private void Awake()
    {
        proximitySensor = GetComponent<Proximity>();

        proximityRun = new Utility.IntervalRun(0.2f, (deltaTime) =>
        {
            proximitySensor.Detect(OnProximityDetect);
        });
        proximityRun.Start();
        isUsed = false;
        tracker = GetComponent<Tracker>();

        parentRoom = GetComponentInParent<Room>();
        if (parentRoom != null)
        {
            parentRoom.OnVisibilityChange += OnRoomChangeVisibility;
            if (parentRoom.IsPlayerInRoom)
            {
                enabled = true;
            }
            else
            {
                enabled = false;
            }
        }
    }
Ejemplo n.º 2
0
    private void Awake()
    {
        meshRenderer = GetComponentInChildren<MeshRenderer>();
        redLight = GetComponentInChildren<Light>();
        rBody = GetComponent<Rigidbody>();
        myCollider = GetComponentInChildren<Collider>();

        proximitySensor = GetComponent<Proximity>();

        proximityRun = new Utility.IntervalRun(0.2f, (deltaTime) =>
        {
            proximitySensor.Detect(OnProximityDetect);
        });

        Stop();

        timeStyle = new GUIStyle
        {
            alignment = TextAnchor.MiddleCenter,
            normal = { textColor = Color.yellow }
        };
    }
Ejemplo n.º 3
0
    private void Awake()
    {
        proximitySensor = GetComponent<Proximity>();
        audioSource = GetComponent<AudioSource>();
        proximityRun = new Utility.IntervalRun(0.2f, (deltaTime) =>
        {
            proximitySensor.Detect(OnProximityDetect);
        });
        proximityRun.Start();
        State = DoorState.Closed;
        lastState = State;

        // Left Door
        openPosition = new Vector3(-MoveDistance, 0f, 0f);
        closedPosition = new Vector3(0f, 0f, 0f);

        foreach (var room in PositiveDisableObjects)
        {
            room.Doors.Add(this);
        }
        foreach (var room in NegativeDisableObjects)
        {
            room.Doors.Add(this);
        }

        HideShowDoor();
        Initialize();
    }
Ejemplo n.º 4
0
    private void Awake()
    {
        killable = GetComponent<Killable>();
        killable.OnDamage += OnDamage;
        killable.OnDie += OnDie;
        playerController = GetComponent<CharacterController>();
        meshAnimator = GetComponent<Animator>();
        meshAnimator.speed = 1.5f;

        inventory = new PlayerInventory();
        inventory.MaxAmmunition.Add(AmmunitionType.Bullets, 128);
        inventory.MaxAmmunition.Add(AmmunitionType.Shells, 40);
        inventory.MaxAmmunition.Add(AmmunitionType.Cells, 160);
        inventory.MaxAmmunition.Add(AmmunitionType.Grenades, 12);
        inventory.MaxAmmunition.Add(AmmunitionType.ProximityMines, 10);
        inventory.MaxAmmunition.Add(AmmunitionType.Rockets, 8);

        inventory.CollectedItems.Add(new Attachment { Name = "Silencer", Type = AttachmentType.Muzzle, NoiseModifier = -20f, Prefab = "WeaponAttachment/Inspect/InspectSilencer" });
        //inventory.CollectedItems.Add(new Attachment {Name = "Iron Sight", Type = AttachmentType.Scope});
        inventory.CollectedItems.Add(new Attachment { Name = "Extended Mag", Type = AttachmentType.Magazine, ClipSizeModifier = 4, Prefab = "WeaponAttachment/Inspect/InspectExtendedMagazine" });

        weaponInstances = new List<Gun>();

        if (InitialGun != null)
        {
            inventory.Ammunition[InitialGun.AmmunitionType] = InitialGunAmmunition;

            var primaryGun = InitializeWeapon(InitialGun);
            weaponInstances.Add(primaryGun);
            SelectWeapon(0);

            var loadAmount = GetReloadAmount();
            inventory.Ammunition[InitialGun.AmmunitionType] -= loadAmount;
            primaryGun.SetClipRemaining(loadAmount);
            inventory.Weapons.Add(primaryGun);
        }

        isEnabled = true;
        current = this;

        runNoiseInterval = new Utility.IntervalRun(0.2f, (deltaTime) =>
        {
            World.SoundAt(transform.position, StepNoise);
        });
        runNoiseInterval.Start();

        UniversePosition = transform.position;

        World.AddShiftable(this);
    }