Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by masteproofgamel · Jun 26, 2016 at 06:02 AM · c#script.enemy healthplayer damage

method of notifying when a creature is killed

I just need a script who describes the way you can say player kills an enemy. Or someone could explain me the logic of this. Thanks in advance.

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 Mindmapfreak · Jun 26, 2016 at 11:16 AM 0
Share

Do you already have some code? Depending on your design, there can be a large number of different answers to this question ... Generally you could take a look at the observer-pattern.

avatar image Nick4 · Jun 26, 2016 at 01:02 PM 0
Share

Yep, as Chris suggests it depends on your design. I'd say go for events if you can't use something simple as this piece of code :

 if(creature.health < 1) {
     creature.$$anonymous$$ill();
     Notify$$anonymous$$ill(creature);
 }

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by SarperS · Jun 26, 2016 at 12:56 PM

Events is the way to go, here's a nice official tutorial from the Unity Tech http://unity3d.com/learn/tutorials/topics/scripting/events?playlist=17117

Comment
Add comment · Show 1 · Share
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 masteproofgamel · Jun 27, 2016 at 03:15 AM 0
Share

Sorry but I still dont understand. I wanna say in scripting that player kills a creature. Could be good saying in the creature's health script:

 if(curHealth >= 1 && _playerDamage.isAttacking == true)
 {
     _player$$anonymous$$illedCreatureName == true;
 }

And in the quest script:

 if(_player$$anonymous$$illedCreatureName (i dont know how to say 6 times) && questIsActive == true)
 {
       questCompleted == true;
 }
       

If it is correct can someone tell me how I can say the bool is true 6 times?

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

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Move a separate object forward on collision between particle system and another object 0 Answers

Having transitions between two VideoPlayers triggered by clicking "x" times in a text layer 0 Answers

How can I reset the score counter? 2 Answers

trying to fade alpha based on the Y angle using a range so every 90 degrees the material changes but fades back n forth 0 Answers

Save a Image's state 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