示例#1
0
        public override cCritter copy()
        {
            cCritterArmedPlayer c = new cCritterArmedPlayer();

            c.copy(this);
            return(c);
        }
示例#2
0
        public override void copy(cCritter pcritter)
        {
            /*We need to overload the cCritter copy because if I have cCritterArmedRobot which is
             * a cCritterArmed, and it gets split in two by a replicate call, then I want the new
             * copy to have all the same shooting behavior as the old one.  In general, I should
             * overload copy for each of my critter child classes, but for now this one is the
             * most important.  The overload does the regular copy, then looks if the thing
             * being copied is a cCritterArmed, and if it is then it copies the additional fields. */
            base.copy(pcritter);
            if (!pcritter.IsKindOf("cCritterArmedPlayer"))
            {
                return;                                                           //You're done if pcritter isn't a cCritterArmed*.
            }
            cCritterArmedPlayer pcritterplayer = (cCritterArmedPlayer)(pcritter); /* I know it is a
                                                                                   * cCritterArmed at this point, but I need to do a cast, so the compiler will let me
                                                                                   * call a bunch of cCritterArmed methods. */

            _sensitive = pcritterplayer._sensitive;
        }