Technically, by writing this, you did not create an object. You created a class that derives from UnityEngine.MonoBehaviour-class that derives from UnityEngine.Behaviour-class that derives from UnityEngine.Component-class that derives from UnityEngine.Object-class that derives from System.Object-class. (So it’s an Object because it’s derived from Object-class, but it’s not an Object in the ObjectOrientedProgrammingTheory sense)
have a look at Unity’sRuntime-Class-Hierarchy (unfortunately System.Object is not noted in this list. only UnityEngine.)
Only when you attach it to a GameObject you are instantiating it and thereby making it an Object in the oop sense. But note: Components are sort of ‘crippled’ Objects as they can not exist on their own but only when attached to a GO.
So when you attach it, it’s being instantiated and a ‘subObject’ for the GameObject is created.
The GameObject now has - via its ‘subObject’ - the variables ‘DamageRes’ and ‘ForceRes’ (you don’t have to do anything else for the GameObject to ‘have the properties’).
But it’s not doing anything with it. The function is never called.
As aldonaletto explains, it needs to be set off by built-in functions that are themselves set off by the UnityEngine at given times.
Additional to the ScriptReference, you can have a read on functions that can set off other functions
So you can not create a ‘javascript object within this script’ in the oop sense. But I’m guessing you are asking if you have to create ANOTHER something in this script. Obviously you can not create an additional ‘javascript object within this script’ either.
You could create another class in this script, but that is not particularly good conduct and for you level of knowledge completely irrelevant.
As aldonaletto says, you should do some more tutorials first. start here [it has a bit of a super-noob touch to it, but the info is valid. I’m quite certain you can still learn from it; esp. to get a starting-point on how read and understand the Scripting-Reference is an invaluable], then go to the endless list of stuff and when you have 2-3 of the big tutorials down and still got knots in your head, then come back…
additional Note: you should start variable-names with lower case and function-names with upper case.
Edit: don’t forget to mark an answer ‘accepted’.
Edit2: Please don’t invent new tags (java script) when there are perfect substitutes (javascript)! >.<
Greetz, Ky.