Пример #1
0
    // Use this for initialization
    void Start()
    {
        if(thoughtMan==null) thoughtMan = GameObject.Find("ThoughtManager").GetComponent<ThoughtManager>();
        myAI = GetComponent<AI> ();

        InitIdeas();
    }
Пример #2
0
    public void SpawnSpeech(ThoughtManager.Idea i)
    {
        if(currentSpeech)
        {
            Destroy(currentSpeech.gameObject);
            currentSpeech = null;
        }

        currentSpeech = GameObject.Instantiate(SpeechPrefab, Player.player.transform.position + transform.up * 1f, Quaternion.identity) as GameObject;
        Speech s = currentSpeech.GetComponent<Speech>();
        currentSpeech.AddComponent<PlayerSpeech> ().idea = i;
        currentSpeech.name = "Player's " + currentSpeech.name;

        FollowObject follow = currentSpeech.AddComponent<FollowObject>();

        follow.follow = Player.player.gameObject;
        follow.normalOffset = new Vector3(0, 1.5f, 0);
        follow.rotateSpeed = 0;
        follow.moveSpeed = 5;

        s.transform.FindChild("Bubble").GetComponent<SpriteRenderer>().color = Player.player.GetComponent<Human>().Body.color;

        ThoughtManager.Idea ideaToUse = i;
        Sprite spriteToUse = ideaToUse.sprite;
        Color colorToUse = ideaToUse.color;
        colorToUse = Color.Lerp(colorToUse, Color.white, 0.4f);

        s.InitChildSprites(spriteToUse, colorToUse);
    }
Пример #3
0
    public void AddThought(ThoughtManager.Idea idea)
    {
        Ideas.Add(idea);

        if(Mathf.Abs(idea.starsign - myAI.Starsign)<myAI.starsignDiff)
        {
            GoodIdeas.Add(idea);
        }
        else// if((1-Mathf.Abs(idea.starsign - Starsign))<starsignDiff)
        {
            BadIdeas.Add(idea);
        }
    }
Пример #4
0
    public void ThinkAbout(ThoughtManager.Idea idea)
    {
        if (!thoughts.Ideas.Contains (idea)) {
            thoughts.AddThought(idea);
        }

        if (IsThisAGoodIdea(idea)) {

            float happinessAdd = (1 - Mathf.Abs(Starsign - idea.starsign)) * 0.5f;

            thoughts.GoodIdeas.Add(idea);
            UpdateOpinion(happinessAdd);
        }

        if (IsThisABadIdea(idea)) {

            float angryAdd = Mathf.Abs(Starsign - idea.starsign) * 0.5f;

            thoughts.BadIdeas.Add(idea);
            UpdateOpinion(-angryAdd);
        }
    }
Пример #5
0
    void InitButton(Vector3 position, Vector2 size, ThoughtManager.Idea idea, Sprite sprite, Color color)
    {
        GameObject newButton = new GameObject(sprite.name,
                                              typeof(RectTransform),
                                              typeof(CanvasRenderer),
                                              typeof(Image),
                                              typeof(Button),
                                              typeof(CoolAnimation));
        newButton.transform.position = position;
        newButton.GetComponent<RectTransform>().sizeDelta = size;
        newButton.GetComponent<Image>().sprite = sprite;
        newButton.GetComponent<Image>().color = color;

        float randFreq = Random.Range(1,2);
        if(Random.value>0.5f) randFreq = -randFreq;
        newButton.GetComponent<CoolAnimation>().Frequency = randFreq;
        newButton.GetComponent<CoolAnimation>().RotationAxis = new Vector3(0,0,1);
        newButton.GetComponent<CoolAnimation>().RotationSpeed = 20f;

        newButton.transform.SetParent(this.transform, true);

        newButton.GetComponent<Button>().onClick.AddListener(() => Say(idea));
    }
Пример #6
0
 public void Say(ThoughtManager.Idea i)
 {
     SpawnSpeech(i);
 }
Пример #7
0
 bool IsThisAGoodIdea(ThoughtManager.Idea idea)
 {
     return thoughts.GoodIdeas.Contains (idea);
 }
Пример #8
0
 // Use this for initialization
 void Awake()
 {
     thoughtMan = this;
     InitIdeas();
 }