Beispiel #1
0
    void SetupAI()
    {
        //set up AI
        aiActive            = true;
        this.startTransform = new SaveTransform(this.transform);
        stateController     = GetComponent <EnemyStateController>();
        stateController.SetupStateController(this);

        //set up for Patrol skeleton
        curPatrolIndex = 0;

        //set up start state
        switch (skeletonType)
        {
        case SkeletonType.Idle:
            stateController.currentState = skeletonIdleStartState;
            break;

        case SkeletonType.Dance:
            stateController.currentState = skeletonDanceStartState;
            break;

        case SkeletonType.Patrol:
            stateController.currentState = skeletonPatrolStartState;
            break;

        default:
            break;
        }
    }
Beispiel #2
0
    private void SetupAI()
    {
        //get enemy state controller
        stateController = GetComponent <EnemyStateController>();

        //SetFlyHeightFromGround(flyHeight);
        aiActive = true;
        stateController.SetupStateController(this);
        rb.constraints = RigidbodyConstraints.FreezeRotation;

        //so darkling know where to return
        this.startTransform = new SaveTransform(this.transform);

        //assign type for darkling
        switch (darklingType)
        {
        case DarklingType.Idle:
            stateController.currentState = darklingIdleStartState;
            break;

        case DarklingType.Wander:
            stateController.currentState = darklingWanderStartState;
            break;

        //if not assign, leave it there
        default:
            break;
        }
    }
Beispiel #3
0
    // Pour créer et sauvegarder un SaveTransform
    public void SaveTransformRotPos(Transform t, float time)
    {
        SaveTransform st = new SaveTransform();

        st.time = time;
        st.rot  = t.rotation;
        SaveTransforms.Add(st);
        Save();
    }
Beispiel #4
0
 public void Load()
 {
     System.IO.StreamReader sw = new System.IO.StreamReader(fileName);
     SaveTransforms.Clear();
     while (!sw.EndOfStream)
     {
         SaveTransform t = new SaveTransform();
         // On saute la ligne contenant le numéro de la sauvegarde.
         sw.ReadLine();
         // On récupère le temps associé à la sauvegarde
         float time = System.Single.Parse(sw.ReadLine());
         t.time = time;
         // On récupère la rotation associé à la sauvegarde
         float x = System.Single.Parse(sw.ReadLine());
         float y = System.Single.Parse(sw.ReadLine());
         float z = System.Single.Parse(sw.ReadLine());
         float w = System.Single.Parse(sw.ReadLine());
         t.rot = new Quaternion(x, y, z, w);
         SaveTransforms.Add(t);
     }
     sw.Close();
 }
Beispiel #5
0
 void Start()
 {
     destroyBulletsScript = currentTargets.GetComponent<DestroyBullets>();
     targetTransform = new SaveTransform(currentTargets.transform);
 }
Beispiel #6
0
 public void SetTransform(SaveTransform obj, int index)
 {
     transforms[index] = new SaveTransform();
     transforms[index] = obj;
 }