Example #1
0
    //public Texture cow1;
    //public Texture cow2;
    void Start()
    {
        //cowAnim = cow.GetComponent<UITextureAnimation>();
        //cowAnimation = cow.GetComponent<NPCDialogueAnimation>();
        cowAnimation = this.gameObject.GetComponent<NPCDialogueAnimation>();
        shakeIt = this.gameObject.GetComponent<BalkiShake>();
        walk = this.gameObject.GetComponent<DuckWalk>();
        zMov = transform.gameObject.GetComponent<MoveTowardTrain>();

        //Squash and stretch
        myStretch = GetComponent<UIStretch>();
        initialStretchY = myStretch.relativeSize.y;
        currStretchY = initialStretchY;

        bouncing = false;

        currPos = new Vector3(0, 0, 0);
        //InvokeRepeating("startBounce", 0f, 5f);
    }
Example #2
0
    void Awake()
    {
        // Set static instance to this object
        instance = this;
        initialRotation = transform.rotation;

        if (GameManager.WasInitialized () && GameManager.Instance.playerPosition != null) {
            this.transform.position = GameManager.Instance.playerPosition.position;
        }

        // Find the navigation mesh agent in the gameobject (3D)
        playerNavigation = GameObject.FindObjectOfType(typeof(NavMeshAgent)) as NavMeshAgent;
        // Find the main camera (3D)
        sceneCamera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<Camera>();

        if(!GameObject.Find("FarDistance_Pos")){
            farDistance = Vector3.Distance(sceneCamera.transform.position, transform.position);
        }

        else{
            //Debug.Log("Found Far Distance Pos");
            Vector3 farDistancePos = GameObject.Find("FarDistance_Pos").transform.position;
            farDistance = Vector3.Distance(sceneCamera.transform.position, farDistancePos);
        }
        scaleCameraRatio = farDistance - nearDistance;

        GameObject spritePrefab = ResourceManager.LoadObject ("Player/" + ApplicationState.Instance.selectedCharacter + "Sprite");
        GameObject spriteInstance = Instantiate (spritePrefab) as GameObject;
        spriteInstance.transform.parent = transform;
        spriteInstance.transform.localPosition = new Vector3(0,0.76f,0);

        animationsList = spriteInstance.GetComponent<NPCAnimations> ();
        animationControl = spriteInstance.GetComponent<NPCDialogueAnimation> ();
        animationFlip = spriteInstance.GetComponent<FlipTexture> ();

        animationStretch = GetComponentInChildren<UIStretch>();

        spriteScale = spriteInstance.transform;
        scalePlayerRatio = farScale - nearScale;

        spritePrefab = null;
        Resources.UnloadUnusedAssets ();
    }
 void setFriendAnimation(NPCAnimations.AnimationIndex animationType, NPCDialogueAnimation anim)
 {
     NPCAnimations.AnimationSequence currAnimSeq = anim.GetComponent<NPCAnimations>().RetrieveAnimationSequence(animationType);
     List<Texture> currAnimSeqTextures = currAnimSeq.textures;
     if (currAnimSeqTextures.Count > 0)
     {
         anim.StopAnimation();
         anim.SetAnimationList(currAnimSeqTextures);
         anim.PlayAnimation();
         anim.SetSpeed(currAnimSeq.speed);
     }
 }
Example #4
0
    // Use this for initialization
    void Start()
    {
        Sherlock.Instance.SetBubblePosition(Sherlock.side.DOWN);

        teacherScript.teacherCollider.enabled = false;

        teacherAnimation = teacher.GetComponent<NPCDialogueAnimation>();

        setTeacherAnimation(NPCAnimations.AnimationIndex.IDLE);
        teacherSpeechBubble.SetActive(false);
        tutorialCow.SetActive(false);
        tutorialMoon.SetActive(false);

        setTeacherAnimation(NPCAnimations.AnimationIndex.INSTRUCTING);
        Respond(preIntro1);
        tutorialOptions.SetActive(false);
        Invoke("StartIntroduction", preIntro1.voiceOver.length + preIntro2.voiceOver.length);
    }