コード例 #1
0
ファイル: AIController.cs プロジェクト: alexschacher/TheGame
    private void UpdateDebugText()
    {
        if (!GameObject.Find("Program").GetComponent <ConsoleCommand>().IsDebugVisible())
        {
            thisEntity.SetDebugText("");
            return;
        }

        string debugMsg1 = "";

        // Show Nearby Entities
        foreach (KeyValuePair <EntityOLD, EntityOLD.Disposition> kvp in nearbyEntities)
        {
            debugMsg1 += (GetDisposition(kvp.Key) + " to " + kvp.Key.transform.name + "\n");
        }

        // Show Behavior
        debugMsg1 += currentBehaviorState.ToString();

        // Show Target
        if (targetEntity != null)
        {
            string targetName = targetEntity.transform.name;
            targetName = targetName.Replace("Pfb_Entity_", "");
            targetName = targetName.Replace("AI_", "");
            debugMsg1 += " " + GetDisposition(targetEntity) + " " + targetName;
        }

        // Show Health
        // debugMsg1 += "\n" + thisEntity.GetCurrentHealth() + "/" + thisEntity.GetMaxHealth();

        thisEntity.SetDebugText(debugMsg1);
    }
コード例 #2
0
    void Update()
    {
        // Debug Text
        if (GameObject.Find("SceneControl").GetComponent <ConsoleCommand>().IsDebugVisible())
        {
            entity.SetDebugText("P" + playerNumber);
        }
        else
        {
            entity.SetDebugText("");
        }

        // Debug Invincible
        if (GameObject.Find("SceneControl").GetComponent <ConsoleCommand>().IsInvincible())
        {
            entity.ModifyHealth(1000);
        }

        // Jump Control
        if (Input.GetButtonDown("Jump_P" + playerNumber))
        {
            entity.CommandJump();
        }
        else
        {
            //entity.CommandTerminateJump();
        }

        // Attack Control
        if (Input.GetButtonDown("Attack_P" + playerNumber))
        {
            entity.CommandAttack();
        }

        // Movement Control
        entity.CommandSetMovementVector(
            MovementVectorCameraConverter.convertMovementVector(
                Input.GetAxisRaw("Walk_Vertical_P" + playerNumber),
                Input.GetAxisRaw("Walk_Horizontal_P" + playerNumber)));
    }