//public Animator doorAnimator;
    //public float doorPosition;

    void Awake()
    {
        aircraft = GetComponent <AIAircraftSpawn>();
        pilot    = GetComponent <AIPilot>();
        rb       = GetComponent <Rigidbody>();
        //doorAnimator = GetComponentInChildren<Animator>();

        gearAnimator = GetComponentInChildren <GearAnimator>();
        tailHook     = GetComponentInChildren <Tailhook>();
        catHook      = GetComponentInChildren <CatapultHook>();
        refuelPort   = GetComponentInChildren <RefuelPort>();
        wingRotator  = pilot.wingRotator;

        kPlane   = GetComponent <KinematicPlane>();
        fuelTank = GetComponent <FuelTank>();

        waypoint = new Waypoint();
        GameObject waypointObject = new GameObject();

        waypointObject.AddComponent <FloatingOriginTransform>();
        waypoint.SetTransform(waypointObject.transform);

        tilter = GetComponent <TiltController>();

        normalSpeed = pilot.navSpeed;

        health = GetComponent <Health>();
        health.OnDeath.AddListener(OnDeath);
    }
Esempio n. 2
0
    private void Awake()
    {
        kplane = GetComponent <KinematicPlane>();
        actor  = GetComponent <Actor>();

        if (kplane != null)
        {
            kplane.enabled = false;
            Debug.Log("Dissabled kplane on " + gameObject.name);
        }
        else
        {
            Debug.Log("Could not find kplane on " + gameObject.name);
        }

        rb             = GetComponent <Rigidbody>();
        rb.isKinematic = true;

        FloatingOriginTransform originTransform = GetComponent <FloatingOriginTransform>();

        if (originTransform == null)
        {
            originTransform = gameObject.AddComponent <FloatingOriginTransform>();
        }

        originTransform.SetRigidbody(rb);

        Networker.RigidbodyUpdate += RigidbodyUpdate;
    }