Ejemplo n.º 1
0
    private IEnumerator SetInvincibility(byte duration)
    {
        CurrentPlayerEffect = SpecialEffects.Invincibility;
        yield return(new WaitForSeconds(duration));

        CurrentPlayerEffect = SpecialEffects.NoEffect;
    }
    private void SetEffect(string effect, DirectionTarget facing, Level inLevel, TrashCan who)
    {
        // Display Small Spark Effect on Hit
        SpecialEffects spark = new SpecialEffects(effect, facing, inLevel, who);

        InLevel.GameItems.Add(spark);
    }
Ejemplo n.º 3
0
        private void SetEffect(string effect, Actor who, RolentoEnemy p)
        {
            // Display Small Spark Effect on Hit
            SpecialEffects spark = new SpecialEffects(effect, who.Position, InLevel, p);

            InLevel.GameItems.Add(spark);
        }
Ejemplo n.º 4
0
 private static SpecialEffects Get()
 {
     if (singletonInstance == null)
     {
         singletonInstance = FindObjectsOfType <SpecialEffects>()[0];
     }
     return(singletonInstance);
 }
Ejemplo n.º 5
0
 // Use this for initialization
 void Start()
 {
     maxHp          = hp;
     healthBar      = GameObject.FindWithTag("Healthbar").GetComponent <Slider>();
     gameController = GameObject.FindWithTag("GameController").GetComponent <GameController>();
     effects        = GameObject.FindWithTag("Script").GetComponent <SpecialEffects>();
     soundEffects   = GameObject.FindWithTag("Script").GetComponent <SoundEffects>();
     lastDmgTaken   = 0;
 }
Ejemplo n.º 6
0
    void Awake()
    {
        if (Instance != null)
        {
            Debug.LogError("Multiple instances of SpecialEffectsHelper!");
        }

        Instance = this;
    }
Ejemplo n.º 7
0
    void Awake()
    {
        // Register the singleton
        if (Instance != null)
        {
            Debug.LogError("Multiple instances of SpecialEffectsHelper!");
        }

        Instance = this;
    }
Ejemplo n.º 8
0
 public void ProcessEquipLineTest()
 {
     for (int m_i = 0; m_i < 13; m_i++)
     {
         string line     = m_TestLineArray[m_i];
         Stats  stats    = new Stats();
         bool   isArmory = false;
         SpecialEffects.ProcessEquipLine(line, stats, isArmory, 0, 0);
         string szExpected = m_ExpectedArray[m_i].ToString();
         string szStats    = stats.ToString();
         Assert.AreEqual(szExpected, szStats, line);
     }
 }
Ejemplo n.º 9
0
    public void SpawnGroundParticle()
    {
        isGroundWithParticle = _rays.IsCrossed(0);

        if (isGroundWithParticle)
        {
            _specialEffects = _rays.GetCrossInformaiton(0).collider.GetComponent <SpecialEffects>();

            if (_specialEffects == true)
            {
                Instantiate(_specialEffects.landParticles, particlePosition);
            }
        }
    }
Ejemplo n.º 10
0
    public void PlayLandSound()
    {
        isGroundWithParticle = _rays.IsCrossed(0);

        if (isGroundWithParticle)
        {
            _specialEffects = _rays.GetCrossInformaiton(0).collider.GetComponent <SpecialEffects>();

            if (_specialEffects == true)
            {
                audioSorce.pitch = Random.Range(0.7f, 1.4f);
                audioSorce.PlayOneShot(_specialEffects.landSound);
            }
        }
    }
Ejemplo n.º 11
0
    public void PlayJumpSound()
    {
        isGroundWithParticle = _rays.IsCrossed(0);

        if (isGroundWithParticle)
        {
            _specialEffects = _rays.GetCrossInformaiton(0).collider.GetComponent <SpecialEffects>();

            if (_specialEffects == true)
            {
                audioSorce.pitch = 0.9f;
                audioSorce.PlayOneShot(_specialEffects.jumpSound);
            }
        }
    }
Ejemplo n.º 12
0
    void Start()
    {
        GameObject.FindGameObjectWithTag("persistentObject").GetComponent <CreateAndDestroyAppointment>().OnAppointmentStarted();

        usedSeed = SeedTheLevel();

        // spawn appropriate number of people and add them to the allPeople list
        allPeople.AddRange(SpawnPeople(currentLevelInfo.level));

        InitiateLevel();
        SaveStartingState();

        // generate random order of faces
        int        numFaces       = GetAllPeople()[0].faces_normal.Count;
        List <int> sequentialList = new List <int>();

        for (int i = 0; i <= numFaces; i++)
        {
            sequentialList.Add(i);
        }
        List <int> randomList = new List <int>();

        for (int i = numFaces; i >= 0; i--)
        {
            int n = Random.Range(0, i);
            randomList.Add(sequentialList[n]);
            sequentialList.RemoveAt(n);
        }

        foreach (Person _person in GetAllPeople())
        {
            _person.Initialize(randomList[0]);
            randomList.RemoveAt(0);
        }

        selectionCursorInst = Instantiate(selectionCursor) as GameObject;
        selectionCursorInst.GetComponent <Renderer>().enabled = false;
        selectionCursorInst.transform.parent = transform;

        cursorSecondaryInst = Instantiate
                              (
            cursorSecondary, new Vector3
            (
                selectionCursorInst.transform.position.x, selectionCursorInst.transform.position.y, selectionCursorInst.transform.position.z + 1.5f
            ), Quaternion.identity
                              ) as GameObject;
        cursorSecondaryInst.GetComponent <Renderer>().enabled = false;
        cursorSecondaryInst.transform.parent = selectionCursorInst.transform;

        myAudioComponent = gameObject.GetComponent <AudioSource>() as AudioSource;
        if (SaveGame.GetAudioOn_sfx())
        {
            isAudioOn_sfx = true;
        }
        else
        {
            isAudioOn_sfx = false;
        }

        // set restart button position (to the left of the audio icons)
        Vector3    MusicButtonPos     = GameObject.Find("audioToggle_music").transform.position;
        Vector3    SFXButtonPos       = GameObject.Find("audioToggle_sfx").transform.position;
        float      difference         = Vector3.Distance(MusicButtonPos, SFXButtonPos);
        GameObject restartLevelButton = GameObject.Find("restartLevel");

        if (restartLevelButton != null)
        {
            restartLevelButton.transform.position = new Vector3(MusicButtonPos.x - difference, MusicButtonPos.y, MusicButtonPos.z);
        }

        specialEffects = GetComponent <SpecialEffects>();
        // reset seed back to something random
        Random.seed = (int)System.DateTime.Now.Second;
        textBubble  = GetComponent <TextBubble>();
        textBubble.Init(allPeople);

                #if UNITY_WEBPLAYER
        GameObject.Find("redAndGreenButtons").GetComponent <Renderer>().material = redAndGreenButton_keys;
                #endif
    }
Ejemplo n.º 13
0
 void Destroy()
 {
     Instance = null;
 }
Ejemplo n.º 14
0
    void Awake()
    {
        Instance = this;

        specialEffectParent = new GameObject("Special effects").transform;
    }
Ejemplo n.º 15
0
 public void AddSpecialEffect(SpecialEffect effect)
 {
     SpecialEffects.Add(effect);
     effect.AddTarget(this);
 }
Ejemplo n.º 16
0
 void Awake()
 {
     instance = this;
 }
    // TODO: add UI or audio feedback for a sale happening.
    // This is called from BusinessSystem
    public void ShowSale(PotionType PotionType)
    {
        int amount = GameData.singleton.potionPrices[(int)PotionType];

        SpecialEffects.ShowNumberChange(GetPotionGroup(PotionType), amount, Color.yellow);
    }
Ejemplo n.º 18
0
 void Awake()
 {
     instance = this;
 }
Ejemplo n.º 19
0
    // Update is called once per frame
    void Update()
    {
        // Tap effect
        // Checks for all fingers
        for (int i = 0; i < Input.touchCount; i++)
        {
            Touch touch = Input.GetTouch(i);

            // A tap is a quick touch and release
            if (touch.phase == TouchPhase.Ended && touch.tapCount == 1)
            {
                // Touches are screen locations, this converts them in to world locations
                Vector3 position = Camera.main.ScreenToWorldPoint(touch.position);

                // Creates the Explosion Effect
                SpecialEffects.MakeExplosion((position));
            }

            else
            {
                // Controls for the Swipe Gesture
                if (touch.phase == TouchPhase.Began)
                {
                    // Store this new value
                    if (trails.ContainsKey(i) == false)
                    {
                        // Touches are screen locations, this converts them in to world locations
                        Vector3 position = Camera.main.ScreenToWorldPoint(touch.position);
                        // Ensures the trail is visible
                        position.z = 0;

                        // Creates the Trails Effect
                        GameObject trail = SpecialEffects.MakeTrail(position);

                        // If the trail is still enabled
                        if (trail != null)
                        {
                            // Log the trail
                            Debug.Log(trail);
                            // Add some more Trails
                            trails.Add(i, trail);
                        }
                    }
                }

                else if (touch.phase == TouchPhase.Moved)
                {
                    // Moves the trail
                    if (trails.ContainsKey(i))
                    {
                        // Array for the Trails
                        GameObject trail = trails[i];

                        // Converts touches in to world locations
                        Camera.main.ScreenToWorldPoint(touch.position);
                        Vector3 position = Camera.main.ScreenToWorldPoint(touch.position);
                        // Ensures trail is visible
                        position.z = 0;

                        // Sets position of the trails to position of the finger
                        trail.transform.position = position;
                    }
                }

                else if (touch.phase == TouchPhase.Ended)
                {
                    // Clears all visible trails
                    if (trails.ContainsKey(i))
                    {
                        GameObject trail = trails[i];

                        // Fades trails out
                        Destroy(trail, trail.GetComponent <TrailRenderer>().time);
                        trails.Remove(i);
                    }
                }
            }
        }
    }
Ejemplo n.º 20
0
 public bool IsSpecial(out SpecialEffects function)
 {
     function = SpecialEffects.None;
     return(false);
 }
Ejemplo n.º 21
0
    void Start()
    {
        GameObject.FindGameObjectWithTag("persistentObject").GetComponent<CreateAndDestroyAppointment>().OnAppointmentStarted();

        usedSeed = SeedTheLevel();

        // spawn appropriate number of people and add them to the allPeople list
        allPeople.AddRange(SpawnPeople(currentLevelInfo.level));

        InitiateLevel();
        SaveStartingState();

        // generate random order of faces
        int numFaces = GetAllPeople()[0].faces_normal.Count;
        List<int> sequentialList = new List<int>();
        for (int i = 0; i <= numFaces; i++)
        {
            sequentialList.Add(i);
        }
        List<int> randomList = new List<int>();

        for (int i = numFaces; i >= 0; i--)
        {
            int n = Random.Range(0, i);
            randomList.Add(sequentialList[n]);
            sequentialList.RemoveAt(n);
        }

        foreach (Person _person in GetAllPeople())
        {
            _person.Initialize(randomList[0]);
            randomList.RemoveAt(0);
        }

        selectionCursorInst = Instantiate(selectionCursor) as GameObject;
        selectionCursorInst.GetComponent<Renderer>().enabled = false;
        selectionCursorInst.transform.parent = transform;

        cursorSecondaryInst = Instantiate
            (
                cursorSecondary, new Vector3
                (
                    selectionCursorInst.transform.position.x, selectionCursorInst.transform.position.y, selectionCursorInst.transform.position.z + 1.5f
                ), Quaternion.identity
            ) as GameObject;
        cursorSecondaryInst.GetComponent<Renderer>().enabled = false;
        cursorSecondaryInst.transform.parent = selectionCursorInst.transform;

        myAudioComponent = gameObject.GetComponent<AudioSource>() as AudioSource;
        if (SaveGame.GetAudioOn_sfx()) { isAudioOn_sfx = true; }
        else { isAudioOn_sfx = false; }

        // set restart button position (to the left of the audio icons)
        Vector3 MusicButtonPos = GameObject.Find("audioToggle_music").transform.position;
        Vector3 SFXButtonPos = GameObject.Find("audioToggle_sfx").transform.position;
        float difference = Vector3.Distance(MusicButtonPos, SFXButtonPos);
        GameObject restartLevelButton = GameObject.Find("restartLevel");
        if (restartLevelButton != null)
        {
            restartLevelButton.transform.position = new Vector3(MusicButtonPos.x - difference, MusicButtonPos.y, MusicButtonPos.z);
        }

        specialEffects = GetComponent<SpecialEffects>();
        // reset seed back to something random
        Random.seed = (int)System.DateTime.Now.Second;
        textBubble = GetComponent<TextBubble>();
        textBubble.Init(allPeople);

        #if UNITY_WEBPLAYER

        GameObject.Find("redAndGreenButtons").GetComponent<Renderer>().material = redAndGreenButton_keys;

        #endif
    }
Ejemplo n.º 22
0
 void Awake()
 {
     // Assigning the value of instance to this script
     instance = this;
 }
Ejemplo n.º 23
0
 public bool IsSpecial(out SpecialEffects function)
 {
     function = SpecialEffects.None;
     return false;
 }
Ejemplo n.º 24
0
 void Start()
 {
     if(instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this);
     }
 }