コード例 #1
0
    private void OnTriggerEnter(Collider other)
    {
        if (currentHandState == HandState.Fired)
        {
            if (other.tag == "Player")
            {
                playerScript = other.transform.parent.GetComponent <PF_Player>();

                playerScript.SetCanMove(false);

                playerScript.ModifyCurrentHealth(-grabDamage);
                //Craig Added learning data
                var learning = FindObjectOfType <BossAttacks>();
                learning.BlockLearn.Data.Add(new NaiveBayesLearning.InformationModel()
                {
                    Lable    = "Hand",
                    Features = new List <string>()
                    {
                        "Hit", "Attack"
                    }
                });

                other.transform.parent.transform.parent = transform;

                currentHandState = HandState.Retract;
            }
        }
    }
コード例 #2
0
    private void FixedUpdate()
    {
        if (currentHandState == HandState.Fired)
        {
            if (currentDistance < maxDistance)
            {
                modifierDistance = targetDirection.magnitude * firePower;

                currentDistance += modifierDistance;

                transform.position += targetDirection * firePower;
            }
            else
            {
                currentHandState = HandState.Retract;
            }
        }

        if (currentHandState == HandState.Retract)
        {
            if (currentDistance > 0)
            {
                modifierDistance = targetDirection.magnitude * firePower;

                currentDistance -= modifierDistance;

                transform.position += -targetDirection * firePower;
            }
            else
            {
                transform.position = homeTransform.transform.position;
                transform.rotation = homeTransform.transform.rotation;

                if (playerScript != null)
                {
                    playerScript.gameObject.transform.parent = null;

                    playerScript.SetCanMove(true);
                }

                currentDistance = 0f;

                currentHandState = HandState.Idle;

                //KRISTINA WAS HERE
                attackManagerScript.NextAttack = true;
            }
        }
    }