示例#1
0
    //public Vector3 RollinSpeed = Vector3.zero;
    //private bool rollin = false;

    void Start()
    {
        animator         = GetComponent <Animator>();
        logicalRigidBody = GetComponent <Rigidbody>();
        capsule          = GetComponent <CapsuleCollider>();
        var rikishis = FindObjectsOfType <RikishiController>();

        if (rikishis[0] != this)
        {
            enemy = rikishis[0];
        }
        else if (rikishis[1] != this)
        {
            enemy = rikishis[1];
        }

        var rendererer = GetComponentInChildren <Renderer>();

        rendererer.material       = new Material(Shader.Find("Standard"));
        rendererer.material.color = Random.ColorHSV(0, 1, 0.5f, 1);

        StartCoroutine(MonkeyPatchFlyingSumoWreslterBug());

        physicalRigidBodies = ragdollParent.GetComponentsInChildren <Rigidbody>();
        DisableRagdoll();
    }
 void Start()
 {
     mainCameraTransform           = Camera.main.transform;
     playerTransform               = GameObject.FindWithTag("Player").transform;
     rikishiController             = GetComponent <RikishiController>();
     zeFlabben                     = GetComponent <ParameterizedFlabbiness>();
     scoreboard                    = FindObjectOfType <Scoreboard>();
     zeFlabben.Flabbiness          = scoreboard.GetPlayerScore() * 34f;
     rikishiController.shoveForce += zeFlabben.Flabbiness * 3;
 }
    void Start()
    {
        mainCameraTransform           = Camera.main.transform;
        playerTransform               = GameObject.FindWithTag("Player").transform;
        rikishiController             = GetComponent <RikishiController>();
        zeFlabben                     = GetComponent <ParameterizedFlabbiness>();
        scoreboard                    = FindObjectOfType <Scoreboard>();
        animator                      = GetComponent <Animator>();
        zeFlabben.Flabbiness          = scoreboard.GetEnemyScore() * 34f;
        rikishiController.shoveForce += zeFlabben.Flabbiness * 3;

        trackingTransform          = new GameObject().transform;
        trackingTransform.position = playerTransform.position;
        trackingTransformStartY    = trackingTransform.position.y;

        // BT class from the 2D Game Kit
        // https://learn.unity.com/tutorial/2d-game-kit-advanced-topics#5c7f8528edbc2a002053b77a
        //behaviorTree.OpenBranch(

        //    //BT.If(() => { return m_EnemyBehaviour.Target != null; }).OpenBranch(
        //    //    BT.Call(m_EnemyBehaviour.CheckTargetStillVisible),
        //    //    BT.Call(m_EnemyBehaviour.OrientToTarget),
        //    //    BT.Trigger(m_Animator, "Shooting"),
        //    //    BT.Call(m_EnemyBehaviour.RememberTargetPos),
        //    //    BT.WaitForAnimatorState(m_Animator, "Attack")
        //    //),

        //    BT.If(TestPlayerInStrikingDistance).OpenBranch(
        //        BT.Trigger(animator, "Stop Dancing"),
        //        BT.Call(Attack),
        //        BT.Wait(StrikeDelay)
        //    ),

        //    BT.Call(LockOntoTarget)
        //);

        behaviorTree.OpenBranch(
            BT.RandomSequence(new int[] { 3, 1 }).OpenBranch(
                BT.Sequence().OpenBranch(
                    //BT.Log("Chasing Player"),
                    BT.RunCoroutine(GetWithinStrikingDistanceOfThePlayer),
                    BT.Call(Attack),
                    BT.RunCoroutine(GetReadyForNextAttack)
                    ),
                BT.Sequence().OpenBranch(
                    BT.While(() => PlayerIsInStrikingDistance() == false).OpenBranch(
                        //BT.Log("Avoiding Player"),
                        BT.Call(() => ImOnTheEdgeOfTheDohyo()),
                        BT.Call(SitStill),
                        BT.Call(LockOntoTarget)
                        )
                    )
                )
            );
    }