Exemplo n.º 1
0
        public override float Evaluate(Creature creature)
        {
            Submarine currentSubmarine       = Player.main.currentSub?.GetComponent <Submarine>();
            LiveMixin liveMixin              = currentSubmarine?.GetComponent <LiveMixin>();
            bool      pastBiteRefractoryTime = Time.time > lastBiteTime + BITE_REFRACTORTY_PERIOD;
            bool      withinRange            = distanceToMannedSub <= MAX_DISTANCE;

            bool possibleAttack = currentSubmarine != null && liveMixin != null && liveMixin.IsAlive() && pastBiteRefractoryTime && withinRange;

            return(possibleAttack ? GetEvaluatePriority() : 0f);
        }
Exemplo n.º 2
0
    private void Start()
    {
        // Get a reference to the rigidbody of the submarine so we can control it.
        _rigidbody = Submarine.GetComponent <Rigidbody>();

        GetSliders();
        GetImages();
        GetTexts();

        maxSpeed = (addforce / _rigidbody.drag - 0.01f * addforce) / _rigidbody.mass;

        // Set the center of mass and intertiaTensor to the center of the object.
        _rigidbody.centerOfMass          = Vector3.zero;
        _rigidbody.inertiaTensorRotation = Quaternion.identity;
    }