Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Shiro_Rin · Apr 26, 2015 at 09:03 PM · zombies

Barrier script and adding points

I've been following a "make your own cod zombies" tutorial but sadly there hasnt been a video in months so I'm adding the other features in myself. My script is using UnityEngine; using System.Collections;

 public class boardScript : MonoBehaviour {
     public int boards, previousBoards;
     public Animator[] boardAnim;
     public GameObject[] board;
     public AudioClip repairSound;
     public AudioClip bangSound;
     public int pointValue;
     public static int fakeround;
     public static int fakecounter=0;
     // Use this for initialization
     void Start () {
         boardAnim = GetComponentsInChildren<Animator> ();
         for (int i = 0; i < 6; i++)
         {
             boardAnim[i].Play ("boardAnimation" + (i+1).ToString());
         }
         boards = 6;
 
     }
     
     // Update is called once per frame
     void Update () {
         fakeround = GameManagement.roundCounter * 5;
     }
 
     void AddBoard()
     {
                 if (boards < 6) {
                         GetComponent<Renderer> ().enabled = true;
                         board [boards].SetActive (true);
                         boardAnim [boards].Play ("boardAnimation" + (boards + 1).ToString ()); 
                         boards += 1;
                         GetComponent<AudioSource> ().PlayOneShot (repairSound, 1.0f / GetComponent<AudioSource> ().volume);
                         Invoke ("SlamSound", 1f);
                         StartCoroutine (points ());
                         fakecounter += 1;
                         if (fakecounter == fakeround) {
                         StopCoroutine (points ());
                         }
                 }
         }
 
     IEnumerator points(){
         GameManagement.AddPoints(pointValue);
         yield return(0);
         }
 
     void RemoveBoard()
     {
         if(boards > 0)
         {
             board[boards-1].SendMessage("DisableBoard",SendMessageOptions.RequireReceiver);
             boards -= 1;
             
             if(boards == 0)
                 GetComponent<Renderer>().enabled = false;
 
         }
     }
 
     void SlamSound()
     {
         GetComponent<AudioSource>().PlayOneShot (bangSound, 1.0f / GetComponent<AudioSource>().volume);
     }
 }
 
 
 
 
 
 
 
 Now notice where the IENumerator is.  That is called for every board as to "add points" for repairing barriers.  Well as in zombies, they only allow this a certain amount of times each round. I tried to do this by stopping the courutine however it still gets called when repairing barriers.  I really need help with this. I'm lost as to how else to approach this
Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Calum1015 · Apr 27, 2015 at 01:38 AM 0
Share

You have an awful lot of errors in there, improper syntax etc. I think we could help you easier if it actually worked at least a bit.

avatar image Shiro_Rin · Apr 27, 2015 at 03:40 AM 0
Share

It does work actually , perfectly. It's part of a series of scripts.I got it working though. I had it in the answers but I guess it never updated

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Zombies keep stopping in mid chase 1 Answer

How to make my zombies move over these windows? 0 Answers

Zombie Spawn Per Round Script 2 Answers

How do i Kill Enemy with Vehicle?? 2 Answers

how is it possible to make a sound based spawning system? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges