// Use this for initialization
    void Start()
    {
        c_Stats = GetComponent <HumanCurrentStats>();
        death   = GetComponent <HumanDeath>();

        speedIncreaseRate = c_Stats.stats.maxSpeed / maxSpeedAge;
        speedDecreaseRate = (c_Stats.stats.maxSpeed - c_Stats.stats.minSpeed) / (c_Stats.stats.maxAge - maxSpeedAge);
    }
    public void OnThrownCollision(GameObject collisionObject)
    {
        Debug.Log("human collision with " + collisionObject.gameObject);

        RaiseDeathEvent();
        PerformDie();

        HumanDeath otherHumanDeath = collisionObject.GetComponent <HumanDeath>();

        if (otherHumanDeath != null)
        {
            Debug.Log("other human Die");
            RaiseDeathEvent();
            otherHumanDeath.PerformDie();
        }
    }
    private void DoTorn()
    {
        if (targetObject == null)
        {
            return;
        }

        SoundManager.instance.PlayRandom("Orc Torn");

        HumanDeath humanDeath = targetObject.GetComponent <HumanDeath>();

        if (humanDeath != null)
        {
            humanDeath.TornApart(gameObject);
        }

        ReleaseTarget();

        isTorning = false;
    }
    private void ChangeHumanGrabbed(bool grabbed)
    {
        if (targetObject == null)
        {
            return;
        }

        HumanMovement humanMovement = targetObject.GetComponent <HumanMovement>();

        if (humanMovement != null)
        {
            humanMovement.isGrabbed = grabbed;
        }

        HumanDeath humanDeath = targetObject.GetComponent <HumanDeath>();

        if (humanDeath)
        {
            humanDeath.attacker = gameObject;
            //StartCoroutine(ResetHumanGrabbed(humanDeath));
        }
    }
Beispiel #5
0
        protected override void Update(GameTime gameTime)
        {
            Camera.Update(gameTime);

            /*
             * if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||
             *  Keyboard.GetState().IsKeyDown(Keys.Escape))
             *  Exit();
             */

            // Mouse
            //ToDo 1 Fix mouse getting 'stuck' in fullscreen mode
            MouseCoordinates = Cursor.GetMouseCoordinates();
            Cursor.GetMouseCoordinates();
            Cursor.UpdateCursorRectangleLocation();

            //Update Tree Foliage Transparency
            Trees.ChangeTreeFoliageTransparency();


            if (Debug.Debug.IsDebugEnabled)
            {
                fps.Update(gameTime);
            }


            if (ResolutionChanged)
            {
                ResolutionHandler.SetResolution();
                Graphics.ApplyChanges();
            }


            Camera.Position = CameraPosition;


            #region User Interface

            if (BuildMenuPane.IsBuildMenuWindowVisible)
            {
                BuildMenuRollOverText.GenerateRollOverText();
                BuildMenuPane.CloseBuildMenu();
            }


            if (BuildingPlacementHandler.IsPlacingBuilding)
            {
                BuildingPlacementHandler.CheckIfGroundClear(Blueprint);
                BuildingPlacementHandler.PlaceAStructure(BuildingPlacementHandler.SetBuildingTexture());
            }


            //Menu
            if (!Bulldozer.IsBulldozerActive)
            {
                BuildMenuInteraction.CheckCursorMenuInteraction(Cursor.CursorRectangle);
            }

            if (BuildMenuInteraction.IsBuildMenuOpen && !Bulldozer.IsBulldozerActive)
            {
                BuildMenuInteraction.CheckBuildIconInteraction();
            }

            if (BuildMenuPane.IsBuildMenuWindowVisible && !Bulldozer.IsBulldozerActive)
            {
                BuildMenuPane.UpdateBuildMenuWindowLocation();
            }


            // Details Pane
            DetailsPaneInteraction.CheckForDetailsPaneInteraction();
            DetailsPaneMovement.UpdateDetailsPaneLocation();

            // Selected Pawn
            if (SelectedPawn.SelectedHuman != null)
            {
                SelectedPawn.UpdateIndicator(SelectedPawn.SelectedHuman);
                ExtendIconChecks.CheckExtendHandClicked();
                PawnInfo.UpdatePawnInfo();
            }
            #endregion

            #region PawnInfoSB
            PawnCursorInteraction.CheckForCursorPawnInteraction();

            if (PawnInfo.IsPawnInfoVisible)
            {
                PawnInfo.ClosePawnInfo();
            }

            if (ExtendIconChecks.IsWeaponIconListVisible)
            {
                EquipWeapon.CheckWeaponIconInteraction();
                CreateItemIcons.UpdateWeaponIconList();
            }

            #endregion

            ZedDeath.CheckZedsHealth();
            RuinedBuilding.CheckBuildingsHealth();
            HumanDeath.CheckHumansHealth();

            ZedController.IncreaseZeds();


            //Building Removal
            if (Bulldozer.IsBulldozerActive)
            {
                Bulldozer.DemolishStructure();
            }

            //Movement
            //HumanMovement.RunFromZeds();
            PathFind.MovePawns();


            CheckMouseStateChange.UpdateMouseState();
            KeyBindings.CheckForKeyInput();
            KeyBindings.CheckForMouseInput();

            Resource.SetResourcesForGathering();


            base.Update(gameTime);
        }
    private IEnumerator ResetHumanGrabbed(HumanDeath humanDeath)
    {
        yield return(new WaitForSeconds(timeForHumanReset));

        humanDeath.attacker = null;
    }